Search code examples
mysqlsecuritycoldfusion-8password-hash

how to use md5 encryption for password field in mysql database in coldfusion


I am implementing an application in which I must insert encrypted passwords into a MySQL database. Then retrieve the decrypted password from the database using md5 encryption in ColdFusion.

How can I use md5 encryption in ColdFusion with a MySQL database?


Solution

  • md5 is a one way hash, it cannot be reversed.

    You should never store decryptable passwords in the database. Store the md5 hash only. When the user tries to login, generate an md5 hash of the plain text password. Then compare it to the md5 hash stored in the db.