Just use the bcrypt defaults. You will be fine. You will in particular be so much better off than salted SHA-1 that this topic will be mooted. Later on, maybe in 5-10 years, you can re-engage with the debate about what a good cost factor for bcrypt will be in 2020.
So now people are twitchy about "just use the defaults", especially when it comes to something they don't really understand, like cryptography.
I've been looking into this over the past few days, and I've decided to just extract the relevant files from py-bcrypt, and get rid of the compatibility layer.
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/crypt/
Its from OpenBSD and implemented by the developers of the algorithm. It is what the Python/Ruby/Lisp/PHP etc. versions are derived from or wrap
There is no chance that, after selecting bcrypt, you will be forced to scramble to replace it with salted SHA-1 hashes. bcrypt is strictly better than what you're doing now.
You could do something similar.
PBKDF2(password, iterations=10) == PBKDF2(PBKDF2(password, iterations=5), iterations=5)
Thus you could, say, increase the number of iterations every month. All that said, you should still use bcrypt; this is just an interesting property IMO.
http://stackoverflow.com/questions/3722780/do-any-security-e...
I think I'm right in choosing bcrypt, but one interesting argument against it was that, being slower, it would facilitate DoS attacks. You want the password hashing to be slow to prevent brute-forcing, but, if it's too slow, attackers could supposedly DoS your login system by trying tons of passwords.
I'm not a security expert, and I didn't know what to respond to that. How would one mitigate this problem? Is it even really a problem?
You can always store the password of the users again and update the crypto used, (more iterations, different digest algorithm). It's never a question of if it will be broken, but when.
Choosing iterations for a PBKDF takes a bit of common sense, yes if you're going to roflscale and think 100000000 iterations is a good idea currently, then you may run into performance issues.
The correct balance is performance vs security and you can only choose one. You want to authenticate the user as fast as possible while also making it unfeasible to recover the data. As with everything, a little common sense and knowledge goes a long way.
Takeaway: Cost to crack one MD5 password: $1. Cost to crack one scrypt password: $50M to $200B.
You want your login to be slow compared to the rest of your application. It's okay to take half a second to verify a login.
Note that almost nobody uses scrypt. We don't recommend it, not because it's insecure, but because it's painful to implement for most companies.
But use either. Or just use PBKDF2. All of the adaptive hashes are fine.
> All of the adaptive hashes are fine.
I am so glad you say this.I can't count the arguments I've heard centered around what is The One True Way to store passwords... this topic turns every programmer on the planet into an instant Crypto Expert (TM).
STFU and use one. Hell, glib's crypt() lets you pick any of three computationally expensive schemes, so use one of those.
I find this a bit of a misnomer. I understand what you mean in context, of course, but, strictly speaking, bcrypt is a "hash", and "salted" is always good.
> Salted hashes are a straight-up vulnerability. -- tptacek