Last active
February 13, 2018 17:47
-
-
Save BlakeGardner/5811216 to your computer and use it in GitHub Desktop.
Benchmark of all the hashing algorithms provided by PHP
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 | |
foreach (hash_algos() as $algo) { | |
$start_time = microtime(TRUE); | |
for ($index = 0; $index <= 500000; $index++) { | |
$hash = hash($algo, $index); | |
} | |
$end_time = microtime(TRUE); | |
$total = sprintf('%01.2f', $end_time - $start_time); | |
echo "{$total}|{$algo}\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment