How to compare two encrypted bcrypt password in laravel

0 votes

How to compare two bcrypt password

$pass1 = '$2y$10$ooPG9s1lcwUGYv1nqeyNcO0ccYJf8hlhm5dJXy7xoamvgiczXHB7S';

And

$pass2 = '$2y$10$QRgaiS6bpATKKQeT22zGKuHq.edDfXQc2.4B3v.zaN.GtGwoyQuMy';

Both $pass1 & $pass2 are bcrypt for 'test'.

How I can check for equality. without using text 'test' like this

$hash1 = Hash::make('test');
$hash2 = Hash::make('test');

var_dump(Hash::check('test', $hash1) && Hash::check('test', $hash2));
Oct 21, 2020 in Laravel by kartik
• 37,520 points
5,387 views

1 answer to this question.

0 votes

Hello @kartik,

You can simply use Hash::check() method eg:

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

Hope it helps!!

Thank You!!

answered Oct 21, 2020 by Niroj
• 82,840 points

Related Questions In Laravel

0 votes
1 answer

How to pass data through URL and access through controller in Laravel?

Hello, You can  first refer how to  Create controller through ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
11,928 views
0 votes
1 answer

How to identify wheather the request is HTTP GET or HTTP POST in Laravel?

Hey, In order to identify the type of ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,840 points
3,304 views
0 votes
1 answer

How to mock a static facade methods in Laravel?

Hey, Facades provide a "static" interface to classes ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,840 points
6,574 views
0 votes
2 answers

How to delete or clear caching in Laravel?

You can call an Artisan command outside ...READ MORE

answered Dec 16, 2020 in Laravel by Rajiv
• 8,870 points
95,592 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,084 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
3,017 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,950 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,891 views
0 votes
1 answer

How to match input password and database hash password in laravel?

Hello @kartik, First, you'll need to find the ...READ MORE

answered Sep 30, 2020 in Laravel by Niroj
• 82,840 points
6,217 views
0 votes
1 answer

How to pass URL param in Laravel?

Hello, First you have to go to routes ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
5,210 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP