note 75741 added to function.md5

From: Date: Wed, 13 Jun 2007 21:35:57 +0000
Subject: note 75741 added to function.md5
Groups: php.notes 
Request: Send a blank email to php-notes+get-127462@lists.php.net to get a copy of this message
I ran a small speed test of my own based on comments by sebastian dot haller at freesurf dot ch and tszming at gmail dot com. bin2hex(md5('string', true)) performs faster than md5('string'). However, this binary speed boost does not apply for the hash() function. <?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++) bin2hex(hash('md5', 'string', TRUE)); echo microtime(1)-$time,': bin/hash/md5<br>'; $time=microtime(1); for ($i=0;$i<100000;$i++) bin2hex(md5('string', TRUE)); echo microtime(1)-$time,': bin/md5<br>'; ?> Returns: 0.392316102982: hash/md5 0.725342035294: md5 0.421605110168: bin/hash/md5 0.483132839203: bin/md5 ---- Server IP: 64.71.164.2 Probable Submitter: 207.90.212.178 ---- Manual Page -- http://www.php.net/manual/en/function.md5.php Edit -- https://master.php.net/note/edit/75741 Del: integrated -- https://master.php.net/note/delete/75741/integrated Del: useless -- https://master.php.net/note/delete/75741/useless Del: bad code -- https://master.php.net/note/delete/75741/bad+code Del: spam -- https://master.php.net/note/delete/75741/spam Del: non-english -- https://master.php.net/note/delete/75741/non-english Del: in docs -- https://master.php.net/note/delete/75741/in+docs Del: other reasons-- https://master.php.net/note/delete/75741 Reject -- https://master.php.net/note/reject/75741 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127462) next »