Created
June 27, 2021 21:40
-
-
Save estefanionsantos/c1f3dd6a6902635d90d4c177a1cd8cc1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Rubricate\Hash\PasswordHash; | |
use Rubricate\Hash\AlgorithmHash; | |
$h = new PasswordHash( | |
# new AlgorithmHash(PASSWORD_ARGON2I) | |
new AlgorithmHash(PASSWORD_DEFAULT) | |
); | |
# user input | |
$password = 'your_secret_password'; | |
# $hash = $h->getPassword($password); /* create the hash */ | |
$hash = '$2y$10$JXnoV2WFVRcRXFcqPR6SWeE8jEYTHWBFXABmIZM1.Ve2iKCF1T4GO'; | |
$message ='oops! Logged out user :('; | |
if($h->isPassword($password, $hash)){ | |
$message ='done! Logged in user :D'; | |
} | |
echo $message; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment