in reply to Reversing MySQL's password function
If you wants to store the passwords in a mysql database for an application, the following remark from the mysql manual is maybe relevant:
quote (13.8.2 Encryption Functions: PASSWORD(str)):
Note: The PASSWORD() function is used by the authentication system in MySQL Server, you should not use it in your own applications. For that purpose, use MD5() or SHA1() instead. Also see RFC 2195 for more information about handling passwords and authentication securely in your application.
A better practice is to calculate the SHA1 or MD5 sum of the password and store the results in your database
Both functions, MD5 and SHA1, are one way hash functions. So you can't reverse them to obtain the original 'clear' password.
To authenticate somebody, just recalculate the SHA1 or MD5 sum of the given password in your application using module "Digest::SHA1" or "Digest::MD5". Then query the databank with a simple select statement to check if the calculated MD5/SHA1 value matches the stored value MD5/SHA1 for the user in the database. In that way the password is never send in clear from your application to the database.
|
|---|