I need to use the " \ Hash :: check " out of Laravel .
I do not want to install Laravel because the project is very small, but all passwords are hashed with Laravel .
how I can use the Hash :: check out Laravel ?
Thanks!
I need to use the " \ Hash :: check " out of Laravel .
I do not want to install Laravel because the project is very small, but all passwords are hashed with Laravel .
how I can use the Hash :: check out Laravel ?
Thanks!
If you are using PHP >= 5.5 then you can do hash verification by using password_verify()
function. Internally laravel uses the same function while doing Hash::check()
.
For example:
$hashedPassword = '$2y$10$XEq0uTegk/KlkuOR.xMKfenIH9XpstjTau2qBrQoGiuyGgd/NHXjO';
$password = 'password';
if(password_verify($password, $hashedPassword))
echo 'Password is valid!';
else
echo 'Invalid password.';