2018-03-22 15:51:09 +01:00
|
|
|
package Crypt::Mac;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2018-03-22 15:54:03 +01:00
|
|
|
our $VERSION = '0.058_002';
|
2018-03-22 15:51:09 +01:00
|
|
|
|
2018-03-22 15:54:03 +01:00
|
|
|
use Carp;
|
|
|
|
$Carp::Internal{(__PACKAGE__)}++;
|
|
|
|
use CryptX;
|
2018-03-22 15:51:09 +01:00
|
|
|
|
|
|
|
sub addfile {
|
|
|
|
my ($self, $file) = @_;
|
|
|
|
|
|
|
|
my $handle;
|
|
|
|
if (ref(\$file) eq 'SCALAR') {
|
|
|
|
open($handle, "<", $file) || die "FATAL: cannot open '$file': $!";
|
|
|
|
binmode($handle);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$handle = $file
|
|
|
|
}
|
|
|
|
die "FATAL: invalid handle" unless defined $handle;
|
|
|
|
|
|
|
|
my $n;
|
|
|
|
my $buf = "";
|
2018-03-22 15:54:03 +01:00
|
|
|
local $SIG{__DIE__} = \&CryptX::_croak;
|
2018-03-22 15:51:09 +01:00
|
|
|
while (($n = read($handle, $buf, 32*1024))) {
|
2018-03-22 15:54:03 +01:00
|
|
|
$self->add($buf);
|
2018-03-22 15:51:09 +01:00
|
|
|
}
|
|
|
|
die "FATAL: read failed: $!" unless defined $n;
|
|
|
|
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub CLONE_SKIP { 1 } # prevent cloning
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
2018-03-22 15:54:03 +01:00
|
|
|
=pod
|
|
|
|
|
2018-03-22 15:51:09 +01:00
|
|
|
=head1 NAME
|
|
|
|
|
2018-03-22 15:54:03 +01:00
|
|
|
Crypt::Mac - [internal only]
|
2018-03-22 15:51:09 +01:00
|
|
|
|
2018-03-22 15:54:03 +01:00
|
|
|
=cut
|