K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / usr / share / perl / 5.18.2 / Digest /
server ip : 172.67.156.115

your ip : 172.69.214.189

H O M E


Filename/usr/share/perl/5.18.2/Digest/file.pm
Size1.69 kb
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 10:10
Last modified21-Nov-2018 01:11
Last accessed06-Jul-2025 09:09
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
package Digest::file;

use strict;

use Exporter ();
use Carp qw(croak);
use Digest ();

use vars qw($VERSION @ISA @EXPORT_OK);

$VERSION = "1.16";
@ISA = qw(Exporter);
@EXPORT_OK = qw(digest_file_ctx digest_file digest_file_hex digest_file_base64);

sub digest_file_ctx {
my $file = shift;
croak("No digest algorithm specified") unless @_;
local *F;
open(F, "<", $file) || croak("Can't open '$file': $!");
binmode(F);
my $ctx = Digest->new(@_);
$ctx->addfile(*F);
close(F);
return $ctx;
}

sub digest_file {
digest_file_ctx(@_)->digest;
}

sub digest_file_hex {
digest_file_ctx(@_)->hexdigest;
}

sub digest_file_base64 {
digest_file_ctx(@_)->b64digest;
}

1;

__END__

=head1 NAME

Digest::file - Calculate digests of files

=head1 SYNOPSIS

# Poor mans "md5sum" command
use Digest::file qw(digest_file_hex);
for (@ARGV) {
print digest_file_hex($_, "MD5"), " $_\n";
}

=head1 DESCRIPTION

This module provide 3 convenience functions to calculate the digest
of files. The following functions are provided:

=over

=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
read the file.

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
string.

=back

=head1 SEE ALSO

L<Digest>