Skip to content

Instantly share code, notes, and snippets.

@tbaschak
Created June 17, 2013 04:18
Show Gist options
  • Save tbaschak/5794619 to your computer and use it in GitHub Desktop.
Save tbaschak/5794619 to your computer and use it in GitHub Desktop.
<?php
// needs password_hash from php 5.5 OR compat library from
// https://github.com/ircmaxell/password_compat
require("./password_compat/lib/password.php");
$i = 10;
while($i<20) {
$time_start = microtime(true);
$password = "password001234567890";
$hash = password_hash($password, PASSWORD_BCRYPT, array("cost" => $i));
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "Did password_hash cost $i in $time seconds\n";
$i++;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment