2N/A croak(
"No digest algorithm specified")
unless @_;
2N/A open(F,
"<", $
file) ||
croak(
"Can't open '$file': $!");
2N/ADigest::file - Calculate digests of files 2N/A # Poor mans "md5sum" command 2N/A use Digest::file qw(digest_file_hex); 2N/A print digest_file_hex($_, "MD5"), " $_\n"; 2N/AThis module provide 3 convenience functions to calculate the digest 2N/Aof files. The following functions are provided: 2N/A=item digest_file( $file, $algorithm, [$arg,...] ) 2N/AThis function will calculate and return the binary digest of the bytes 2N/Aof the given file. The function will croak if it fails to open or 2N/AThe $algorithm is a string like "MD2", "MD5", "SHA-1", "SHA-512". 2N/AAdditional arguments are passed to the constructor for the 2N/Aimplementation of the given algorithm. 2N/A=item digest_file_hex( $file, $algorithm, [$arg,...] ) 2N/ASame as digest_file(), but return the digest in hex form. 2N/A=item digest_file_base64( $file, $algorithm, [$arg,...] ) 2N/ASame as digest_file(), but return the digest as a base64 encoded