How to compare two encrypted(bcrypt) password in laravel How to compare two encrypted(bcrypt) password in laravel php php

How to compare two encrypted(bcrypt) password in laravel


if(Hash::check('plain-text-password',$cryptedpassword)) {    // Right password} else {    // Wrong one}


You can simply use Hash::check() methodeg:

if(Hash::check('plain-text', $hashedPassword)) {    return true;}

reference https://laravel.com/docs/5.5/hashing


You can't actually compare two encrypted bcrypt passwords to each other directly as strings because the encryption contains salt which makes the hashes different each time.