note 73792 added to function.hash
| From: | mikael at webhost3 dot eu | Date: | Sat, 10 Mar 2007 13:34:08 +0000 |
| Subject: | note 73792 added to function.hash | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124303@lists.php.net to get a copy of this message | ||
<?php
$time=microtime(1);
for ($i=0;$i<100000;$i++)
hash('md5', 'string');
echo microtime(1)-$time,': hash/md5<br>';
$time=microtime(1);
for ($i=0;$i<100000;$i++)
md5('string');
echo microtime(1)-$time,': md5<br>';
$time=microtime(1);
for ($i=0;$i<100000;$i++)
hash('sha1', 'string');
echo microtime(1)-$time,': hash/sha1<br>';
$time=microtime(1);
for ($i=0;$i<100000;$i++)
sha1('string');
echo microtime(1)-$time,': sha1<br>';
?>------------------------<br><?php
$time=microtime(1);
for ($i=0;$i<100000;$i++)
hash('md5', $i);
echo microtime(1)-$time,': hash/md5<br>';
$time=microtime(1);
for ($i=0;$i<100000;$i++)
md5($i);
echo microtime(1)-$time,': md5<br>';
$time=microtime(1);
for ($i=0;$i<100000;$i++)
hash('sha1', $i);
echo microtime(1)-$time,': hash/sha1<br>';
$time=microtime(1);
for ($i=0;$i<100000;$i++)
sha1($i);
echo microtime(1)-$time,': sha1<br>';
?>
Gives:
0.33311605453491: hash/md5
1.0671429634094: md5
0.383131980896: hash/sha1
1.3252220153809: sha1
------------------------
0.37684988975525: hash/md5
1.1258299350739: md5
0.43960785865784: hash/sha1
1.3876020908356: sha1
----
Server IP: 129.16.214.50
Probable Submitter: 85.228.201.90
----
Manual Page -- http://www.php.net/manual/en/function.hash.php
Edit -- https://master.php.net/note/edit/73792
Del: integrated -- https://master.php.net/note/delete/73792/integrated
Del: useless -- https://master.php.net/note/delete/73792/useless
Del: bad code -- https://master.php.net/note/delete/73792/bad+code
Del: spam -- https://master.php.net/note/delete/73792/spam
Del: non-english -- https://master.php.net/note/delete/73792/non-english
Del: in docs -- https://master.php.net/note/delete/73792/in+docs
Del: other reasons-- https://master.php.net/note/delete/73792
Reject -- https://master.php.net/note/reject/73792
Search -- https://master.php.net/manage/user-notes.php