Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I Have md5 encrypted password, how to give the password to user when he uses "Forgot password"?

I have database entry for password in md5 format, but when user uses the "Forgot password" then how can i give him/her the desired password?

like image 407
OM The Eternity Avatar asked Dec 13 '10 11:12

OM The Eternity


People also ask

How to recover a password from an MD5 hash?

As others described quite well, you cannot easily 'decrypt' an MD5 hash. I guess the best way to do your password recovery is like this: A user can request password recovery by providing his email address (it should be unique so users can be identified by email address).

Why is my Password not accepting MD5 encryption?

03-24-2019 08:19 PM 07-03-2008 04:06 AM You will only specify 5 if the password has been previously encrypted. If you are entering a password and it is not encrypted it not accept it because it is not a valid MD5 string. Below is how to configure a username/password that will use the MD5 encryption.

What is MD5 encryption in PHP?

MD5 is a one-way encryption which means that you cannot decipher the fingerprint to get the original string. Yet another feature of MD5 is that the algorithm will always generate the same fingerprint for a given string. This tutorial demonstrates how to use PHP md5 function to encrypt the passwords in your website.

How to set an MD5 password in phpMyAdmin?

Here is how to set a MD5 password while inserting your values in PHPMyAdmin: Browse to the “users” table (or whatever the name of your table is) The “auto_id” needs to stay empty (will be automatically set) To do this, find the “MD5” function in the dropdown list. Not so complicated hum?


3 Answers

You can't do that from an MD5 hash; nor should you be able to. Password recovery ought to be intractable.

The usual process is to send a password-reset token (URL) to their email address so that the user can choose a new password.

like image 146
Marcelo Cantos Avatar answered Oct 16 '22 20:10

Marcelo Cantos


You can't - MD5 is simply a "one way" hash - not a means of encrypting data that can subsequently be de-crypted.

As such, the general idea is to:

  1. Send the user an email to their registered address with a reset link in it. (To prove they actually own the address.) The reset link should contain a hash based on some aspect of their specific user data so it can't be easily guessed, etc. (e.g.: Account creation time.)

  2. When the user clicks the link they land on a password reset page that checks the above hash, generates a new password (ideally a mix of upper/lower and some numeric characters, although I always tend to omit character such as '0', 'o', 'O', etc. for the sake of clarity) and then sends the user the new password in an email, advising them that they should change this password as soon as possible.

The user can then log-in and access the site as per usual.

like image 39
John Parker Avatar answered Oct 16 '22 22:10

John Parker


You can't do it without putting the password in the database, which is undesirable, but you can generate him/her a new password and send it to them. Or a link where they can reset their password.

like image 20
terminus Avatar answered Oct 16 '22 21:10

terminus