Skip to content

Instantly share code, notes, and snippets.

@ischenkodv
Created January 27, 2013 14:02
Show Gist options
  • Save ischenkodv/4648444 to your computer and use it in GitHub Desktop.
Save ischenkodv/4648444 to your computer and use it in GitHub Desktop.
Usage of Zend\Crypt to generate and verify password hash.
// Create hash
$bcrypt = new Bcrypt();
$bcrypt->setSalt('abcdefghijklmnopqrstufwxyz');
$password = 'dima';
$hash = $bcrypt->create($password);
// Verify password
if ($bcrypt->verify($password, $hash)) {
echo "And there was much rejoicing";
} else {
echo "No shrubbery for you";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment