Subject: | Digest::MD5 changing it's internal state after calling hexdigest |
Date: | Fri, 24 Aug 2012 19:46:50 +0300 |
To: | bug-Digest-MD5 [...] rt.cpan.org |
From: | Andrey Pankov <a.pankov [...] gmail.com> |
Here is example script and test run on some binary file:
[andrey@vaio:~]-» md5sum Sellador.mp3
66911197cbd06414f6d0a8fd66077676 Sellador.mp3
[andrey@vaio:~]-» perl md5.pl Sellador.mp3
66911197cbd06414f6d0a8fd66077676 Sellador.mp3
d41d8cd98f00b204e9800998ecf8427e Sellador.mp3
d41d8cd98f00b204e9800998ecf8427e Sellador.mp3
[andrey@vaio:~]-» cat md5.pl
use Digest::MD5;
$ctx = Digest::MD5->new;
$file = $ARGV[0];
open $fh, '<', $file;
$ctx->addfile($fh);
close $fh;
$digest = $ctx->hexdigest;
print "$digest\t$file\n";
$digest = $ctx->hexdigest;
print "$digest\t$file\n";
$digest = $ctx->hexdigest;
print "$digest\t$file\n";
[andrey@vaio:~]-» uname -a
Linux vaio 2.6.38-15-generic #64-Ubuntu SMP Fri Jul 6 18:51:28 UTC 2012
x86_64 x86_64 x86_64 GNU/Linux
[andrey@vaio:~]-» perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
--
Regards,
Andrey V. Pankov mailto:a.pankov@gmail.com