3 ms·
> The reason for this is that, in general, you can't > transform one kind of encrypted password into another kind > of encrypted password, not unless you have
by sparky 16y ago
> The reason for this is that, in general, you can't
> transform one kind of encrypted password into another kind
> of encrypted password, not unless you have the plaintext
> form.
You have the plaintext form every time your users log in. If you want to change the hashing/encryption scheme, keep a bit for each user denoting whether or not they've been switched to the new scheme. If the bit is clear, hash their password the old way; if it matches, hash it the new way, store that, and set the bit. This is how people usually suggest transitioning from crappy hashing schemes to something more sane, rather than requiring people to sign up for new accounts or actually change their (plaintext) password.
Granted, this requires some logic external to the encryption/hashing module, but the encryption/hashing bit should be relatively pluggable.
- PaulHoule 16y agoI've used this trick to gradually change the encryption used in web user authentication systems and even built it into a framework. It still involves encryption being pluggable at the level of an individual user rather than at the level of a system as a whole.