3 ms·
Now we're getting somewhere. :-) When a user's password is set, generate a random salt, compute K = scrypt(salt, password), and store (user, salt, K) in your d
by cperciva 17y ago
Now we're getting somewhere. :-)
When a user's password is set, generate a random salt, compute K = scrypt(salt, password), and store (user, salt, K) in your database. To verify a password, look up the user's salt value, compute K' = scrypt(salt, password'), and compare K' to K.
You don't need this much strength, but as a matter of course I would recommend using a 256-bit salt and a 256-bit output from scrypt -- the reasoning being that using 256 bits isn't going to be a performance-limiting factor, and that if you try to figure out exactly how many bits you need, there's a risk that you'll make a mistake.
If you can't use scrypt, I'd recommend PBKDF2-SHA256; if that's also unavailable, use bcrypt.
- cryptonewbie 17y agoThanks!