I'm currently working on conversion of an old database format where user login passwords were stored as SHA-1 hashes. That same table also contains other user data that is stored in plaintext.
My goal now is to convert password SHA-1 hashes into PBKDF2 algorithm and then also encrypt plaintext (non-password related) data with AES-256-GCM symmetric cipher using the key derived from the result of running a user password thru PBKDF2. GCM part will also allow for authentication of user passwords & for data integrity.
So I'm trying to research how to do it correctly. Namely, do I convert these records as users try to log in? In that case some good number of entries will still remain with SHA-1 hashes for a while, if not indefinitely, which is NOT good.
So what is the recommended approach here?
pbkdf2(sha1(password))
as well, but the issue is that I have to encrypt the plaintext data too. In that case how would I derive the encryption key if I don't know user password?pbkdf2(sha1(password))
as the encryption key andsha256(pbkdf2(sha1(password)))
as the password hash. Of course in this case if the old hashes are ever leaked from a backup or something your encryption keys are exposed, which is one advantage of waiting for people to log in and starting from scratch instead of using an existing hash.pbkdf2(sha1(password))
is a trivial thing to calculate from the other column entries. So what's the point of doing it?