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()
method
eg:
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.