Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created Aug 26, 2015
Embed
What would you like to do?
<?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