use Digest::MD5; use Digest::SHA1; use Benchmark; my $md5 = Digest::MD5->new(); my $sha1 = Digest::SHA1->new(); open FILE,'<',$0 or die $!; binmode FILE; sub check_md5 { $md5->addfile(*FILE)->hexdigest(),"\n"; } sub check_sha1 { $sha1->addfile(*FILE)->hexdigest(),"\n"; } timethese(10_000_000,{ 'Digest::MD5'=> \&check_md5, 'Digest::SHA1' => \&check_sha1 } ); _ _ END _ _ Benchmark: timing 10000000 iterations of Digest::MD5, Digest::SHA1... Digest::MD5: 27 wallclock secs (26.73 usr + -0.01 sys = 26.72 CPU) @ 374251.50/s (n=10000000) Digest::SHA1: 43 wallclock secs (43.20 usr + 0.00 sys = 43.20 CPU) @ 231465.41/s (n=10000000)