I can't think of a way to do that without actually storing the plain text password. If it is in fact plain text, the irony is that by enforcing such "strong" password requirements, they've actually made the overall system less secure.
But I would guess they use plain text :-(
Previous Password:
New Password:
Confirm New Password:
They don't need to store the plaintext password, as you're giving the old password plaintext to them in the same dialog. Now, if such rules were against "any of your last 4 passwords" instead of just the last password, then that's much more difficult to do. (Obviously nobody is going to cooperate with a form requiring the person to submit their last 4 passwords as part of the password change dialog.)Or did I misunderstand you?
But now that Im writing it out, I was clearly wrong anyways
I thinking something along the lines of taking every substring of 4 characters, and then for all permutations of those 4-tuples, plug it back into the string hash and store. Assuming the goal is to not share any 4-substring with the new string
So I think (N-4) + 1 gives you the number of 4-character windows
4! for the number of permutations of that 4-char window
So 4!*(n-3) total hashes
Which I guess is actually the same work you'd have to do anyways if you stored the plaintext; just without storing each variant