Answer the question
In order to leave comments, you need to log in
Optimal parameters for pbkdf2
I use pbkdf2 to hash user passwords on the site. But I do not quite understand what should be the optimal input parameters for this function: now I have set 1 thousand iterations and the key length is 512. Is this normal or not?
Hash generation source code along with salt (node.js):
crypto.randomBytes(32, (err, buf) => {
if (err) {
return callback(err, null);
}
crypto.pbkdf2(password, buf, 1e3, 512, (err, encodedPassword) => {
if (err) {
return callback(err, null);
}
callback(null, {password: encodedPassword, salt: buf});
});
});
Answer the question
In order to leave comments, you need to log in
Optimal by what criterion? :)
First, try to understand who we are protecting ourselves from and what we are ready to sacrifice.
If you need specific recommendations, then open, for example, NIST SP800-132 “Recommendation for Password-Based Key Derivation”, chapter “A2. PBKDF"
csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf
Or you can read the same things here, for example: www.ietf.org/rfc/rfc2898.txt
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question