views:

89

answers:

1

I am possibly taking over an app that literally just encrypts user passwords by doing md5( password )

They have ~2000 users to date, so I'm wondering how I can migrate those passwords (or can I?) to a stronger encryption schema (e.g. involving a salt, user-specific hash, and their password, all encrypted with sha1, bcrypt, whatever)

Thanks.

+1  A: 

MD5 is a cryptographic hash function, not necessarily an encryption method. A hash is designed to only be performed in one direction, and cannot be reversed other than by dictionary attack. As an example, you can try out this hash database lookup if you're feeling frisky.

You will probably want to save these old passwords in a separate column, then when the users login to the "new" system, compare the MD5'ed version of that password with the old one, and if the digest matches, perform SHA1 with a salt on that password and store that in a separate column.

Alternatively, and probably a better approach, is the force the users to change passwords... and when they enter their new one, use the new hash algorithm on it instead.

John Rasch
thanks! i was thinking something similar - in the interest of avoiding a force the use to change their password system, i was thinking of moving the existing passwords to an additional column, as you mention, and just re-encrypting on the fly. luckily i'm dealing with 2k users vs 20k or 200k.
Kyle