How to decrypt hash password in laravel?


by brandy , in category: PHP Frameworks , 7 months ago

How to decrypt hash password in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by wilmer.lemke , 7 months ago


In Laravel, passwords are typically encrypted using the bcrypt hashing algorithm. Hence, it is not possible to decrypt a bcrypt hashed password; it can only be verified by comparing it with the input provided.

To verify a hashed password, you can use the Hash::check method. Here's how you can do it:

  1. Firstly, ensure that you have imported the Hash facade at the top of your Laravel file:
use IlluminateSupportFacadesHash;

  1. Now, you can use the Hash::check method to compare the input password with the hashed password:
if (Hash::check($inputPassword, $hashedPassword)) {
    // Passwords match
} else {
    // Passwords do not match


  • $inputPassword is the plain text password provided by the user.
  • $hashedPassword is the hashed password stored in your database.

The Hash::check method will return true if the provided password matches the hashed password, and false otherwise.

Remember, bcrypt hashing is a one-way process and is designed to be irreversible for security reasons. Consequently, Laravel provides this Hash::check method for comparison rather than decryption.