note 82816 added to function.hash
| From: | Marcus at osu1 dot php dot net | Date: | Sun, 27 Apr 2008 12:15:29 +0000 |
| Subject: | note 82816 added to function.hash | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138843@lists.php.net to get a copy of this message | ||
A upgrade of dani88elx's performance test, this time grading them by speed (fastest first) and
comparing times between hex and raw data.
<?
function testAlgos() {
$algos = hash_algos();
$word="This will be crypted by all different algoritms";
$results = array();
foreach($algos as $algo)
{
$time=microtime(1);
$data = hash($algo, $word, false);
$results["".(microtime(1)-$time)][] = "$algo (hex)";
}
foreach($algos as $algo)
{
$time=microtime(1);
$data = hash($algo, $word, true);
$results["".(microtime(1)-$time)][] = "$algo (raw)";
}
ksort($results);
foreach($results as $time => &$algos) {
echo $time."\n";
sort($algos);
foreach($algos as $algo)
echo "\t".$algo."\n";
}
}
testAlgos();
?>
----
Server IP: 69.147.83.197
Probable Submitter: 85.8.18.190
----
Manual Page -- http://www.php.net/manual/en/function.hash.php
Edit -- https://master.php.net/note/edit/82816
Del: integrated -- https://master.php.net/note/delete/82816/integrated
Del: useless -- https://master.php.net/note/delete/82816/useless
Del: bad code -- https://master.php.net/note/delete/82816/bad+code
Del: spam -- https://master.php.net/note/delete/82816/spam
Del: non-english -- https://master.php.net/note/delete/82816/non-english
Del: in docs -- https://master.php.net/note/delete/82816/in+docs
Del: other reasons-- https://master.php.net/note/delete/82816
Reject -- https://master.php.net/note/reject/82816
Search -- https://master.php.net/manage/user-notes.php