I'm currently dealing with a couple of user accounts containing MD5 hashed passwords. These accounts got migrated from an old system into our current system which uses PBKDF2 for password hashing. I would like to lift the old accounts to PBKDF2 password hashing as well.
Cracking our own MD5 hashes and rehashing them with PBKDF2 is out of the question.
The first thing that came to mind was migrating the user passwords at login, as described here.
However, I would never be able to migrate all user passwords because some of the users might never return and thus never login again, leaving me forever with insecure hashes.
So two options are left:
- Resetting all passwords and informing the users via email
- Hash the MD5 hashes in the database again with PBKDF2 and use this double hashing when a "legacy user" logs in. Meaning
PBKDF2(MD5(plaintext))
.
First solution would be really unpleasent for the users, because they would have to set a new password, so I'm tending towards the second solution. This seems to support this approach, although talking mainly about bcrypt and not PBDKF2
Is wrapping MD5 in PBKDF2 (or, for what it's worth, other secure hashing algorithms) something that safely can be done, or are there better approaches for dealing with old, insecure MD5 hashes?