From 81054c945a6ebf7a7d9d55a9393c76e3951b6766 Mon Sep 17 00:00:00 2001 From: Alexey Mazurin Date: Tue, 29 Dec 2015 16:42:10 +0400 Subject: missed pack("L", ...) in Agile.pm and Standard.pm --- lib/Spreadsheet/ParseXLSX/Decryptor/Agile.pm | 4 ++-- lib/Spreadsheet/ParseXLSX/Decryptor/Standard.pm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Spreadsheet/ParseXLSX/Decryptor/Agile.pm b/lib/Spreadsheet/ParseXLSX/Decryptor/Agile.pm index 87d73dc..b480c7a 100644 --- a/lib/Spreadsheet/ParseXLSX/Decryptor/Agile.pm +++ b/lib/Spreadsheet/ParseXLSX/Decryptor/Agile.pm @@ -23,7 +23,7 @@ sub _generateDecryptionKey { unless ($self->{pregeneratedKey}) { $hash = $self->{hashProc}->($self->{salt} . Encode::encode('UTF-16LE', $self->{password})); for (my $i = 0; $i < $self->{spinCount}; $i++) { - $hash = $self->{hashProc}->(pack('L', $i) . $hash); + $hash = $self->{hashProc}->(pack('V', $i) . $hash); } $self->{pregeneratedKey} = $hash; } @@ -68,7 +68,7 @@ sub decryptFile { my $i = 0; while (($fileSize > 0) && (my $inlen = $inFile->read($inbuf, $bufferLength))) { - my $blockId = pack('L', $i); + my $blockId = pack('V', $i); my $iv = $self->_generateInitializationVector($blockId, $self->{blockSize}); diff --git a/lib/Spreadsheet/ParseXLSX/Decryptor/Standard.pm b/lib/Spreadsheet/ParseXLSX/Decryptor/Standard.pm index 9c1c381..e5c569d 100644 --- a/lib/Spreadsheet/ParseXLSX/Decryptor/Standard.pm +++ b/lib/Spreadsheet/ParseXLSX/Decryptor/Standard.pm @@ -47,7 +47,7 @@ sub _generateDecryptionKey { unless ($self->{pregeneratedKey}) { $hash = $self->{hashProc}->($self->{salt} . Encode::encode('UTF-16LE', $self->{password})); for (my $i = 0; $i < $self->{spinCount}; $i++) { - $hash = $self->{hashProc}->(pack('L', $i) . $hash); + $hash = $self->{hashProc}->(pack('V', $i) . $hash); } $self->{pregeneratedKey} = $hash; } -- cgit v1.2.3-54-g00ecf