in reply to Re^3: encrypt passwords
in thread encrypt passwords

The beauty of the "only store encrypted passwords" system is that you never have to store the original passwords and that the encryption method by preference does not even have a usable decryption method.

When you have to check whether the password is correct, you simply encrypt the provided password again and check both encrypted passwords. If they are the same then one assumes that the requestor has provided you with the correct password. Of course this is only true when you can be reasonably sure that two different passwords will not lead to the same encrypted password. A well-crafted encryption routine makes the likelihood of such a thing happening very very small.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics