Bug #79024 [NEW]: very slow hash('sha1', ...)

From: Date: Tue, 24 Dec 2019 00:11:18 +0000
Subject: Bug #79024 [NEW]: very slow hash('sha1', ...)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224503@lists.php.net to get a copy of this message
From: bugzilla77 at gmail dot com Operating system: Windows 10 PHP version: 7.4.1 Package: hash related Bug Type: Bug Bug description:very slow hash('sha1', ...) Description: ------------ very slow hash('sha1', ...) Test script: --------------- <?php $i=2000000; $x=sha1(microtime(1).mt_rand()); $time_a=microtime(true); for($z=0;$z<$i;$z++){ $a=sha1($x); } $time_a=microtime(true)-$time_a; $time_b=microtime(true); for($z=0;$z<$i;$z++){ $b=hash('sha1',$x); } $time_b=microtime(true)-$time_b; $time_c=microtime(true); for($z=0;$z<$i;$z++){ $c=hash('sha1',$x,true); } $time_c=microtime(true)-$time_c; print($time_a.' sec'); print('<br/>'); print($time_b.' sec'); print('<br/>'); print($time_c.' sec'); ?> Expected result: ---------------- 0.98706293106079 sec <=0.98706293106079 sec <=0.98706293106079 sec Actual result: -------------- 0.98706293106079 sec 1.248526096344 sec 1.1808590888977 sec -- Edit bug report at https://bugs.php.net/bug.php?id=79024&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79024&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79024&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79024&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79024&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79024&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79024&r=support Expected behavior: https://bugs.php.net/fix.php?id=79024&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79024&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79024&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79024&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79024&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79024&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79024&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79024&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79024&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79024&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79024&r=mysqlcfg

« previous php.bugs (#224503) next »