This question is a fork from a previous question here: Is it safe/wise to store a salt in the same field as the hashed password?
Assume you run a web portal, and store passwords in SHA1 hashes. How do you upgrade this to BCRYPT hashes instead?
Typically, you'd wait for users to log on, and re-hash their passwords (from the plaintext they entered) to BCRYPT. But it could be a while before all users to logon to your platform, and there will always be inactive users who will never come back.
A separate proposal (which I first heard from Troy Hunt) was to BCRYPT the existing SHA1 passwords in your database. Effectively you'd be BCRYPT(SHA1(plaintext_password))
. This way all users on the system get upgraded to BCRYPT at once, regardless of their activity.
This way, a breach on your database, doesn't expose users who haven't logged in yet and still on SHA1.
The question is:
- Is
BCRYPT(SHA1(plaintext_password))
is equivalent in security toBCRYPT(plaintext_password)
- If Not --Why? And is the gap reasonable enough to consider this option?
The question focuses on BCRYPT(SHA1) but could easily apply to any two hash algorithms with the stronger one being applied last.