Search code examples
hashsalt-cryptographypassword-hash

How to recover a password forgotten by the user if the password is saltedhash?


I just learned to use salt and hash to secure the passwords in my database. Now, I need to create a module that will allow the user to recover the password if they forgot it. How can I do that if the password is irreversible?


Solution

  • You don't need to try to recover their old password, you just make a new one for them or have them do it.

    You can generate a temporary password for them, salt and hash that password for them and email them the new password, or you send them an email link to reset their password.