[php-src] Issue #12936: hash() function hangs endlessly if using sha512 on strings >= 4GiB

From: Date: Mon, 11 Dec 2023 20:30:31 +0000
Subject: [php-src] Issue #12936: hash() function hangs endlessly if using sha512 on strings >= 4GiB
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246036@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12936 Author: ohyeaah ### Description The following script hangs endlessly. ```php <?php $t = time(); echo hash("sha512", str_repeat("x", 1024*1024*1024*4-1)); echo "\ncalculating hash took ".(time() - $t)."s\n"; $t = time(); echo hash("sha512", str_repeat("x", 1024*1024*1024*4)); echo "\ncalculating hash took ".(time() - $t)."s\n"; ?> ``` Resulted in this output: ``` f918f25f32fe81f274619743e661a4158f176384d74b46bce7c4305f160119ce727204db2910ff287535ca2e40c2a98f2d23b40c82afbcca750a532b9843e3bc calculating hash took 14s ``` But I expected this output instead: ``` f918f25f32fe81f274619743e661a4158f176384d74b46bce7c4305f160119ce727204db2910ff287535ca2e40c2a98f2d23b40c82afbcca750a532b9843e3bc calculating hash took 14s ...hash goes here... calculating hash took 14s ``` ### PHP Version PHP 8.2.10-2ubuntu1 (cli) (built: Sep 5 2023 14:37:47) (NTS) ### Operating System KUbuntu 23.10

« previous php.bugs (#246036) next »