From a5316b71f57c74d48d064be72ad91b0a2497f641 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 8 Sep 2024 07:58:18 -0500 Subject: [PATCH] Hash: simplify sha512 code --- phpseclib/Crypt/Hash.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/phpseclib/Crypt/Hash.php b/phpseclib/Crypt/Hash.php index 4825c70d..a07e2d8b 100644 --- a/phpseclib/Crypt/Hash.php +++ b/phpseclib/Crypt/Hash.php @@ -1787,10 +1787,7 @@ class Hash // Produce the final hash value (big-endian) // (\phpseclib3\Crypt\Hash::hash() trims the output for hashes but not for HMACs. as such, we trim the output here) - $temp = pack('J', $hash[0]) . pack('J', $hash[1]) . pack('J', $hash[2]) . pack('J', $hash[3]) . - pack('J', $hash[4]) . pack('J', $hash[5]) . pack('J', $hash[6]) . pack('J', $hash[7]); - - return $temp; + return pack('J*', ...$hash); } /**