use Math::Random::MT qw[ rand srand ]; use Digest::CRC qw[ crc64 ]; sub fingerPrintFile{ my $file = shift; my $filesize = -s( $file ); srand $filesize; open my $fh, "<', $file or die $!; ## assuming CRC-64 my $chunks = int( $filesize / 8 ) - 1; ## Added sort per RichardK's suggestion below. my @posns = sort{ $a <=> $b } map 8*int( rand $chunks ), 1 .. 100; my $rawSample = join '', map{ seek $fh, $_, 0; read( $fh, my $chunk, 8 ); $chunk } @posns; close $fh; return crc64( $rawSample ); }