Let's say we have a database with usernames and passwords, where the passwords are naively secured using a single round of SHA-1 (such as was kinda best practice a number of years ago).
Now, let's say we wish to upgrade the security of the credential storage, but users must remain blissfully unaware that any change is taking place.
Obviously, we don't have the passwords in plaintext, but I am considering just treating the sha1(password) as if it was the plaintext password, and secure on top of that.
Here's my thinking:
- Generate random salt per user (128 bit)
- Replace
"username","sha1(password)"
in the database with"username","salt","bcrypt(salt,sha1(password)),iterations=20000"
- Change the validation-code to validate passwords by first doing sha1, then bcrypt the result with the salt n times, and then check.
Are there any glaring faults in this strategy?
While not perfect, is it reasonable to say that this vastly improves the security of the users passwords, in the case of a breach?