How to recover password from MD5?

Tepken Vannkorn picture Tepken Vannkorn · Apr 6, 2012 · Viewed 15.5k times · Source

I'm using md5 to encrypt the user's password in my database, and I want them to get their password back when they forget by sending them email. The problem is I don't know how to write PHP code to recover it back.

Any answer, or appropriate link would be very much appreciated. Thanks..

Answer

user166390 picture user166390 · Apr 6, 2012

This cannot be done1

MD5 is a hashing function and not an encryption function. It is a one-way process and not reversible.

1Actually, there are many such passwords (inputs) which will result in the same MD5 value when hashed, but it's "hard" to find just one and [generally] impossible to find the original one. This is what "cracking" a password does - it finds one such input that, when hashed, results in the particular output. (And I will provide no more help down this road.)