Replace a 32 bit shift with two 16 bit shifts.

The behaviour of a 32 bit shift on a 32 bit integer is undefined.
Replace it with two 16 bit shifts to make it work on a 32 bit Perl.
Ref pandora_enterprise#1417.
This commit is contained in:
Ramon Novoa 2017-10-03 12:48:14 +02:00
parent ebe1f37bf9
commit 98424c20a3
1 changed files with 1 additions and 1 deletions

View File

@ -1363,7 +1363,7 @@ sub md5 {
# Append bit /* bit, not byte */ length of unpadded message as 64-bit # Append bit /* bit, not byte */ length of unpadded message as 64-bit
# little-endian integer to message. # little-endian integer to message.
$msg .= unpack ("B32", pack ("V", $bit_len)); $msg .= unpack ("B32", pack ("V", $bit_len));
$msg .= unpack ("B32", pack ("V", $bit_len >> 32)); $msg .= unpack ("B32", pack ("V", ($bit_len >> 16) >> 16));
# Process the message in successive 512-bit chunks. # Process the message in successive 512-bit chunks.
for (my $i = 0; $i < length ($msg); $i += 512) { for (my $i = 0; $i < length ($msg); $i += 512) {