Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created August 26, 2015 00:10
Show Gist options
  • Save eminetto/5ca794e528da63b4faf8 to your computer and use it in GitHub Desktop.
Save eminetto/5ca794e528da63b4faf8 to your computer and use it in GitHub Desktop.
<?php
include 'vendor/autoload.php';
use Zend\Crypt\Password\Bcrypt;
$password = 'MyDarkSecret';
$hashFromGo = '$2a$10$XCE/s3FRwi.Zg9uswHZdueNmRtYKg8iFOTfWbnhWC71Bm5ur2ce0q';
$bcrypt = new Bcrypt();
$bcrypt->setCost(10);
$hash = $bcrypt->create($password);
echo $hash, "\n";
echo $bcrypt->verify($password, $hash), "\n";
echo $bcrypt->verify($password, $hashFromGo), "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment