use strict; use warnings; use Digest::SHA; my $file = shift; print calculateSHA($file); print "\n"; sub calculateSHA{ my $data = shift; my $val = 0; eval{ my $sha1 = Digest::SHA->new(256); #supposed to be portable and os independant? not working. $sha1->addfile($data, "p"); $val = $sha1->hexdigest; }; if($@){ print "An error occurred calculating the SHA-Value. Cannot verify integrity of file\n$@\n"; } return $val; }