Possible Duplicate:
PHP:How to send the original password to the user when he clicks forgot password which is encrypted by using md5?
I have create a login and register system in php and I want to make a forgot password link to retrieve password from the database. How I do that?
Note: the password in database in encryted using md5 hash
MD5 is a cryptographic hash, not an encryption scheme. It cannot be reversed in any direct way. It can only be brute-forced by trying possible passwords until one which matches is found. This is not recommended.
You cannot reasonably recover the password. Your forgot password link should instead reset the password.
This is intentional and good design. MD5 is used to hash the passwords so that if the password database should be hacked, the hackers will only have access to the hashes of the passwords and not the original passwords, making it difficult for them to discover your users’ passwords.
However, at this point, MD5 crackers have gotten fast enough that it is not recommended for password use. In the future, scrypt or bcrypt should be used as the password hash function.