note 71781 added to function.hash
| From: | anthony dot parsons at manx dot net | Date: | Fri, 15 Dec 2006 15:08:10 +0000 |
| Subject: | note 71781 added to function.hash | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120636@lists.php.net to get a copy of this message | ||
These functions are worth using, if only because they're about twice as fast as the built-in
counterparts:
<?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>';
?>
Gives:
0.36409902572632: hash/md5
0.79715204238892: md5
0.46680307388306: hash/sha1
1.1121778488159: sha1
----
Server IP: 85.116.0.130
Probable Submitter: 87.254.67.133
----
Manual Page -- http://www.php.net/manual/en/function.hash.php
Edit -- https://master.php.net/note/edit/71781
Del: integrated -- https://master.php.net/note/delete/71781/integrated
Del: useless -- https://master.php.net/note/delete/71781/useless
Del: bad code -- https://master.php.net/note/delete/71781/bad+code
Del: spam -- https://master.php.net/note/delete/71781/spam
Del: non-english -- https://master.php.net/note/delete/71781/non-english
Del: in docs -- https://master.php.net/note/delete/71781/in+docs
Del: other reasons-- https://master.php.net/note/delete/71781
Reject -- https://master.php.net/note/reject/71781
Search -- https://master.php.net/manage/user-notes.php