Thread Unterschiedliche MD5 Ergebnisse (35 answers)
Opened by Rambo at 2006-05-11 18:46

GwenDragon
 2006-05-11 19:07
#65985 #65985
User since
2005-01-17
14748 Artikel
Admin1
[Homepage]
user image
Du machst die MD5-Summe über den Dateinamen.

Na, schon mal in die Doku geschaut ;)

Quote
This is useful when calculating checksum for files:

   use Digest::MD5;
   my $file = shift || "/etc/passwd";
   open(FILE, $file) or die "Can't open '$file': $!";
   binmode(FILE);
   $md5 = Digest::MD5->new;
   while (<FILE>) {
       $md5->add($_);
   }
   close(FILE);
   print $md5->b64digest, " $file\n";
Or we can use the builtin addfile method for more efficient reading of the file:

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

<!--EDIT|GwenDragon|1147360362-->

View full thread Unterschiedliche MD5 Ergebnisse