3 ms·
In theory you could, but then the code has to support both login procedures forever (hashing once with scrypt or hashing with SHA1 and then scrypt). That's why,
by akerl_ 13y ago
In theory you could, but then the code has to support both login procedures forever (hashing once with scrypt or hashing with SHA1 and then scrypt). That's why, if it were me, I'd likely set it up so if someone with a SHA1-hashed password logged in, it first did the SHA1 comparison, and if that succeeded the login process dropped an scrypted version into the DB.
- cmircea 13y agoYou could just always do a hash using SHA1 then feed that to bcrypt. This way you only have one code path, for all users.
- akerl_ 13y agoExcept that for some people, you only have a SHA1 hash, and for others, you only have an scrypt hash. Since they (I hope) weren't storing the plaintext (pre-hash) passwords alongside the hashed versions, the only time they can change the initial hashing mechanism is when passwords are provided to them during a password change or user login.
- ErrantX 13y agoHash all the sha1 passwords with scrypt. Hash all new passwords with sha1 then scrypt. Your new hash mechanism is sha1 then scrypt. There is no excuse to do otherwise :)