Created
May 31, 2017 09:13
-
-
Save Clarence-pan/4c05fd2ea3f31722fa6910bc82976c08 to your computer and use it in GitHub Desktop.
测试bcrypt的速度
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 | |
echo sprintf("%10s %10s\n", 'cost', 'time'); | |
for ($cost = 8; $cost < 20; $cost++) { | |
$begin = microtime(true); | |
password_hash('test1234', PASSWORD_BCRYPT, ['cost' => $cost]); | |
$delta = microtime(true) - $begin; | |
echo sprintf("%10d %10.6f\n", $cost, $delta); | |
} |
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
cost time | |
8 0.021307 | |
9 0.037150 | |
10 0.079283 | |
11 0.175612 | |
12 0.317375 | |
13 0.663080 | |
14 1.330451 | |
15 2.245152 | |
16 4.291169 | |
17 8.318790 | |
18 16.472902 | |
19 35.146999 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment