use vars
qw($VERSION @ISA @EXPORT_OK);
@EXPORT_OK = qw(digest_file_ctx digest_file digest_file_hex digest_file_base64);
croak
("No digest algorithm specified") unless @_;
open(F
, $file) || croak
("Can't open '$file': $!");
my $ctx = Digest
->new(@_);
digest_file_ctx
(@_)->digest;
digest_file_ctx
(@_)->hexdigest;
digest_file_ctx
(@_)->b64digest;
Digest::file - Calculate digests of files
# Poor mans "md5sum" command
use Digest::file qw(digest_file_hex);
print digest_file_hex($_, "MD5"), " $_\n";
This module provide 3 convenience functions to calculate the digest
of files. The following functions are provided:
=item digest_file( $file, $algorithm, [$arg,...] )
This function will calculate and return the binary digest of the bytes
of the given file. The function will croak if it fails to open or
The $algorithm is a string like "MD2", "MD5", "SHA-1", "SHA-512".
Additional arguments are passed to the constructor for the
implementation of the given algorithm.
=item digest_file_hex( $file, $algorithm, [$arg,...] )
Same as digest_file(), but return the digest in hex form.
=item digest_file_base64( $file, $algorithm, [$arg,...] )
Same as digest_file(), but return the digest as a base64 encoded