in reply to MD5 Hash

I tested this script with Digest::MD4 and Digest::MD5. The iso was about 699MB. Both had about the same times(approx 10s):

#!/sw/bin/perl use strict; use warnings; use Digest::MD5; my $file = '/Some/user/Desktop/Fedora/FC-6-i386-disc5.iso'; my $ctx = Digest::MD5->new; open 'FILE', '<', $file or die "Can't open $file: $!\n"; $ctx->addfile(*FILE); my $digest = print $ctx->hexdigest, "\n"; close($file);

Replies are listed 'Best First'.
Re^2: MD5 Hash
by johngg (Canon) on Dec 02, 2009 at 17:21 UTC
    my $digest = print $ctx->hexdigest, "\n";

    That code will result in $digest having a value of 1. That's probably not what you meant.

    $ perl -e ' > use Digest::MD5; > $ctx = Digest::MD5->new(); > open FILE, q{<}, q{xxx} or die $!; > $ctx->addfile( *FILE ); > $digest = print $ctx->hexdigest(), qq{\n}; > print qq{-->$digest<--\n};' cc88f0aa880a1b97b84bfd0ebc420fa7 -->1<-- $

    I hope this is useful.

    Cheers,

    JohnGG