note 71781 deleted from function.hash by nlopess
| From: | nlopess@php.net | Date: | Wed, 08 Aug 2007 15:22:14 +0000 |
| Subject: | note 71781 deleted from function.hash by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129319@lists.php.net to get a copy of this message | ||
Note Submitter: anthony dot parsons at manx dot net
----
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