Skip to content

Instantly share code, notes, and snippets.

@estefanionsantos
Created June 27, 2021 21:40
Show Gist options
  • Save estefanionsantos/c1f3dd6a6902635d90d4c177a1cd8cc1 to your computer and use it in GitHub Desktop.
Save estefanionsantos/c1f3dd6a6902635d90d4c177a1cd8cc1 to your computer and use it in GitHub Desktop.
<?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