Created
August 25, 2014 13:30
-
-
Save ezimuel/0769f99e45a04e124cf0 to your computer and use it in GitHub Desktop.
Benchmark Pbkdf2 iterations with ZF2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Benchmark the Pbkdf2 iteration (10'000 = 50 ms, using an Intel i5 CPU at 2) | |
use Zend\Crypt\Key\Derivation\Pbkdf2; | |
use Zend\Math\Rand; | |
$salt = Rand::getBytes(32); | |
$pass = 'this is the password of the user'; | |
$start = microtime(true); | |
$hash = Pbkdf2::calc('sha256', $pass, $salt, 10000, 32); | |
$end = microtime(true); | |
printf ("Hash : %s\n", base64_encode($hash)); | |
printf ("Exec. time: %.2f\n", $end-$start); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment