line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Checksum; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
46
|
|
4
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
202
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.080'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import'; |
8
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => [qw/ adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int |
9
|
|
|
|
|
|
|
crc32_data crc32_data_hex crc32_data_int crc32_file crc32_file_hex crc32_file_int /] ); |
10
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
11
|
|
|
|
|
|
|
our @EXPORT = qw(); |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
117
|
|
14
|
|
|
|
|
|
|
$Carp::Internal{(__PACKAGE__)}++; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# obsolete since v0.057, only for backwards compatibility |
17
|
2
|
|
|
2
|
|
665
|
use Crypt::Checksum::CRC32; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
71
|
|
18
|
2
|
|
|
2
|
|
11
|
use Crypt::Checksum::Adler32; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
700
|
|
19
|
0
|
|
|
0
|
0
|
0
|
sub adler32_data { goto \&Crypt::Checksum::Adler32::adler32_data } |
20
|
0
|
|
|
0
|
0
|
0
|
sub adler32_data_hex { goto \&Crypt::Checksum::Adler32::adler32_data_hex } |
21
|
0
|
|
|
0
|
0
|
0
|
sub adler32_data_int { goto \&Crypt::Checksum::Adler32::adler32_data_int } |
22
|
0
|
|
|
0
|
0
|
0
|
sub adler32_file { goto \&Crypt::Checksum::Adler32::adler32_file } |
23
|
0
|
|
|
0
|
0
|
0
|
sub adler32_file_hex { goto \&Crypt::Checksum::Adler32::adler32_file_hex } |
24
|
0
|
|
|
0
|
0
|
0
|
sub adler32_file_int { goto \&Crypt::Checksum::Adler32::adler32_file_int } |
25
|
0
|
|
|
0
|
0
|
0
|
sub crc32_data { goto \&Crypt::Checksum::CRC32::crc32_data } |
26
|
0
|
|
|
0
|
0
|
0
|
sub crc32_data_hex { goto \&Crypt::Checksum::CRC32::crc32_data_hex } |
27
|
0
|
|
|
0
|
0
|
0
|
sub crc32_data_int { goto \&Crypt::Checksum::CRC32::crc32_data_int } |
28
|
0
|
|
|
0
|
0
|
0
|
sub crc32_file { goto \&Crypt::Checksum::CRC32::crc32_file } |
29
|
0
|
|
|
0
|
0
|
0
|
sub crc32_file_hex { goto \&Crypt::Checksum::CRC32::crc32_file_hex } |
30
|
0
|
|
|
0
|
0
|
0
|
sub crc32_file_int { goto \&Crypt::Checksum::CRC32::crc32_file_int } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub addfile { |
33
|
14
|
|
|
14
|
0
|
28
|
my ($self, $file) = @_; |
34
|
|
|
|
|
|
|
|
35
|
14
|
|
|
|
|
18
|
my $handle; |
36
|
14
|
50
|
|
|
|
32
|
if (ref(\$file) eq 'SCALAR') { #filename |
37
|
14
|
50
|
|
|
|
437
|
open($handle, "<", $file) || croak "FATAL: cannot open '$file': $!"; |
38
|
14
|
|
|
|
|
52
|
binmode($handle); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { #handle |
41
|
0
|
|
|
|
|
0
|
$handle = $file |
42
|
|
|
|
|
|
|
} |
43
|
14
|
50
|
|
|
|
31
|
croak "FATAL: invalid handle" unless defined $handle; |
44
|
|
|
|
|
|
|
|
45
|
14
|
|
|
|
|
16
|
my $n; |
46
|
14
|
|
|
|
|
23
|
my $buf = ""; |
47
|
14
|
|
|
|
|
258
|
while (($n = read($handle, $buf, 32*1024))) { |
48
|
14
|
|
|
|
|
177
|
$self->add($buf) |
49
|
|
|
|
|
|
|
} |
50
|
14
|
50
|
|
|
|
28
|
croak "FATAL: read failed: $!" unless defined $n; |
51
|
|
|
|
|
|
|
|
52
|
14
|
|
|
|
|
243
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
|
|
sub CLONE_SKIP { 1 } # prevent cloning |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Crypt::Checksum - [internal only] |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
You are probably looking for L or L. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |