Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omurphy27/85f78def6ad48a50e7d2 to your computer and use it in GitHub Desktop.
Save omurphy27/85f78def6ad48a50e7d2 to your computer and use it in GitHub Desktop.
php bcrypt password encryption library hash.php
<?php
// http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-hashing-passwords-in-php
require_once 'lib/password.php';
$password = "12345";
$hash = password_hash($password, PASSWORD_BCRYPT);
if ( $hash) {
echo $hash . '<hr>';
}
$password2 = "12345";
if (password_verify($password2, $hash)) {
echo 'password correct';
} else {
echo 'wrong password entered';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment