Skip to content

Instantly share code, notes, and snippets.

@BlakeGardner
Last active February 13, 2018 17:47
Show Gist options
  • Save BlakeGardner/5811216 to your computer and use it in GitHub Desktop.
Save BlakeGardner/5811216 to your computer and use it in GitHub Desktop.
Benchmark of all the hashing algorithms provided by PHP
<?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