in reply to PBKDF2 crypt

I've never heard of it myself, but Wikipedia says:

PBKDF2 (Password-Based Key Derivation Function) is a key derivation function that is part of RSA Laboratories' Public-Key Cryptography Standards (PKCS) series, specifically PKCS #5 v2.0
The specification is available in RFC 2898, and I found an OSS Perl implementation on Google's code search from Palm::Keyring, which I list below:

Thanks to Jochen Hoenicke <hoenicke@gmail.com> # (one of the authors of Palm Keyring) # for these next two subs. # Usage pbkdf2(password, salt, iter, keylen, prf) # iter is number of iterations # keylen is length of generated key in bytes # prf is the pseudo random function (e.g. hmac_sha1) # returns the key. sub _pbkdf2($$$$$) { my ($password, $salt, $iter, $keylen, $prf) = @_; my ($k, $t, $u, $ui, $i); $t = ""; for ($k = 1; length($t) < $keylen; $k++) { $u = $ui = &$prf($salt.pack('N', $k), $password); for ($i = 1; $i < $iter; $i++) { $ui = &$prf($ui, $password); $u ^= $ui; } $t .= $u; } return substr($t, 0, $keylen); }

Whether it conforms to the spec or not is another question :)

If it does, consider CPAN'ing it (with the author's permission)

Clint

Replies are listed 'Best First'.
Re^2: PBKDF2 crypt
by dsheroh (Monsignor) on Aug 11, 2007 at 20:45 UTC
    I had already intended to CPAN it if I had to implement it myself. I'll get in touch with Jochen and see what he has to say about getting it up there (assuming it works right).