Most services, programs, etc. have various password complexity checks. Without delving into the efficacy of such checks, I thought of one that might be interesting, but also potentially problematic check:
"The new password must be Y
characters different from the last X
passwords."
This would prevent people from using passwords like Password1!
, Password2!
, and so on. But if that's done, one cannot hash the previously used password - they would be at best encrypted... Right?
For a small Y
and a fairly short password, you could probably still store the hash and bruteforce all Y
letter variations of the new password, but this gets unfeasible as Y
and the password length grows.
My original idea is this: since when you change the password you must provide your original password, hash the new password and store and the old one in encrypted form. Now it's reversible.
So assuming an active password is always hashed, is there a better way to do this? And also does having this in place increase or decrease the security of the application?