#!/usr/bin/perl -w use strict; use warnings; use Fcntl qw (:DEFAULT :flock); use Digest::CRC; my $datei = 'test_crc.txt'; my $fh; # Datei erzeugen srand (time ^ $$); my @atoms = ('a'..'z', 'A'..'Z' ,0..9); sysopen ($fh,$datei,O_RDWR|O_CREAT) or die "$!"; seek ($fh,0,0); truncate ($fh,0); my $string = ''; my $l = 0; while ($l < 500 * 1024 * 1024) { $string .= $atoms[rand scalar @atoms] . $string . $atoms[rand scalar @atoms]; $l += length ($string); print $fh $string; } # Quersumme print "Start...\n"; my $start = time (); my $ctx = Digest::CRC -> new (type => "crc32"); seek ($fh,0,0); $ctx -> addfile ($fh); my $crc = $ctx -> digest; my $ende = time (); print "$crc\n"; print "Zeit: " . ($ende - $start) . " Sec\n";