Using the OO interface of Digest::MD5 will avoid the
read-the-whole-file-at-once problem:

        use Digest::MD5;
        my $file = shift;
        open(FILE, $file) or die "Can't open '$file': $!";
        binmode(FILE);
        print Digest::MD5->new->addfile(*FILE)->hexdigest, " $file\n"; 

And I'm almost certain this is going to be faster than spawning an
external utility (not even mentioning that you have to make sure the
external utility really exists). 

Tobias
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Bruce McKenzie
Sent: Friday, March 09, 2007 10:31 AM
To: Alexander Apprich; Dennis Daupert
Cc: 'Active State Perl'
Subject: Re: How to generate file signatures?

# we do not use this because it reads the whole file into memory...AT
ONCE!
#use Digest::MD5::File qw(file_md5_hex);

The latter was blowing out my memory when I md5'd 2G files. Openssl
works fine. Also, if you have any sort of hardware accelerator, (Hifn,
etc) they appear to come with new openssl libraries, so you would get
the acceleration benefits.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to