how to decrypt md5 hash
-
Possible Duplicate: http://stackoverflow.com/questions/2780198/phphow-to-send-the-original-password-to-the-user-when-he-clicks-forgot-password 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
-
Answer:
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.
dramasea at Stack Overflow Visit the source
Other answers
md5 is one way. You cannot reverse md5 encrypted strings. Typically, what developers will do when providing a forgot password link is to reset the user's password to something random, give that to them in an email, and then force them to reset their password on next login. Another solution would be to provide them with a random key and a "forgot password link" that can be used to allow them to reset their password. Just in case you are considering it, I want to mention that it's not a good idea to store passwords in the database in plain text. The fact that you can't retrieve the user's password means that a hacker can't either.
jmort253
The whole point of having a hash of a password is that it's impossible to recover the original password from the hash. That way, if someone hacks the password database and steals all the hashes, they can't recover all the user's passwords. In fact, it's mathematically impossible to do so. A hash function maps all of the infinitely many possible strings to a set of strings of fixed length, so there are (ideally!) infinitely many strings that hash to any particular hash value. If you want to make a "forgot your password?" option, it's probably best to just reset the user's password to something random and then send an email containing the new junk password.
templatetypedef
While the other posters are right, i think a specific answer is being sought so here goes. forgot password function can be implemented by using two columns related to the user id. one column is a random string, which can be of arbitrary length, and other the date time. When the user indicates that they have forgotten their password, you generate the random string and update this record with the string and the current date time. you then send an email to their registered email id with a url that has the random string. When that url is opened, you will check if the random string exists in your tables and if it has not been expired. you will check the current date time and the date time on which the string was generated, and you will have your own policy for determining what is the longest you will wait. typically 3 days is enough. if the link is expired, the forgot password will have to be started again. if the link is not expired, you will note the user id for which the string was generated and you will ask the user to enter their username and new password two times. the username has to match the userid for which the string was generated, and the two passwords be the same. you will then update the users password with the md5 hash of the new password. the reason you dont want to generate a new password is because if the user recalls the password, they can still log in, even while their forgot password is in process.
kinjal
If users forget their passwords, you should not be sending them their passwords. Instead they should need to reset their passwords after verifying (perhaps by recieving an email, or some other means) that they are indeed the correct user.
TokenMacGuy
Related Q & A:
- How To Convert Crypt To Md5?Best solution by Stack Overflow
- How To Decrypt A File?Best solution by Yahoo! Answers
- How to decrypt multiple columns?Best solution by Stack Overflow
- How do you hash a string to SHA512 in Swift?Best solution by Stack Overflow
- What is Hash Table, how to create a hash table?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.