Compare Plain String to Hash

Sometimes we need to check if the user typed the correct password, even if the user is authenticated. For example, before changing its settings, we force the user to type the password again to increase the security of our application.

Laravel provides an Illuminate\Support\Facades\Hash facade, which helps us to word with hashing and encryption. If you are interested in its documentation you can find it here: https://laravel.com/docs/5.7/hashing.

Note, since PHP 7.2 you can use the Argon2i hash driver.

So, to compare plain string with its hashed version, the facade offers the check method to perform this action.