line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Digest::FNV; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
141570
|
use 5.010000; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
103
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
201
|
|
6
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
305
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
2
|
|
|
2
|
|
1815
|
use AutoLoader; |
|
2
|
|
|
|
|
3629
|
|
|
2
|
|
|
|
|
11
|
|
10
|
|
|
|
|
|
|
#use Data::Dumper; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
15
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
16
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# This allows declaration use Digest::FNV ':all'; |
19
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
20
|
|
|
|
|
|
|
# will save memory. |
21
|
|
|
|
|
|
|
#our %EXPORT_TAGS = ( 'all' => [ qw( |
22
|
|
|
|
|
|
|
# FNV0_32_INIT |
23
|
|
|
|
|
|
|
# FNV1A_64_LOWER |
24
|
|
|
|
|
|
|
# FNV1A_64_UPPER |
25
|
|
|
|
|
|
|
# FNV1_32A_INIT |
26
|
|
|
|
|
|
|
# FNV1_32_INIT |
27
|
|
|
|
|
|
|
# FNV1_64_LOWER |
28
|
|
|
|
|
|
|
# FNV1_64_UPPER |
29
|
|
|
|
|
|
|
#) ] ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our @EXPORT_OK = ( ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
our @EXPORT = qw( fnv fnv32 fnv32a fnv64 fnv64a ); |
34
|
|
|
|
|
|
|
#= qw( |
35
|
|
|
|
|
|
|
# FNV0_32_INIT |
36
|
|
|
|
|
|
|
# FNV1A_64_LOWER |
37
|
|
|
|
|
|
|
# FNV1A_64_UPPER |
38
|
|
|
|
|
|
|
# FNV1_32A_INIT |
39
|
|
|
|
|
|
|
# FNV1_32_INIT |
40
|
|
|
|
|
|
|
# FNV1_64_LOWER |
41
|
|
|
|
|
|
|
# FNV1_64_UPPER |
42
|
|
|
|
|
|
|
#); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $VERSION = '2.00'; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub AUTOLOAD { |
47
|
|
|
|
|
|
|
# This AUTOLOAD is used to 'autoload' constants from the constant() |
48
|
|
|
|
|
|
|
# XS function. |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
|
0
|
my $constname; |
51
|
0
|
|
|
|
|
0
|
our $AUTOLOAD; |
52
|
0
|
|
|
|
|
0
|
($constname = $AUTOLOAD) =~ s/.*:://; |
53
|
0
|
0
|
|
|
|
0
|
croak "&Digest::FNV::constant not defined" if $constname eq 'constant'; |
54
|
0
|
|
|
|
|
0
|
my ($error, $val) = constant($constname); |
55
|
0
|
0
|
|
|
|
0
|
if ($error) { croak $error; } |
|
0
|
|
|
|
|
0
|
|
56
|
|
|
|
|
|
|
{ |
57
|
2
|
|
|
2
|
|
424
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
480
|
|
|
0
|
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
# Fixed between 5.005_53 and 5.005_61 |
59
|
|
|
|
|
|
|
#XXX if ($] >= 5.00561) { |
60
|
|
|
|
|
|
|
#XXX *$AUTOLOAD = sub () { $val }; |
61
|
|
|
|
|
|
|
#XXX } |
62
|
|
|
|
|
|
|
#XXX else { |
63
|
0
|
|
|
0
|
|
0
|
*$AUTOLOAD = sub { $val }; |
|
0
|
|
|
|
|
0
|
|
64
|
|
|
|
|
|
|
#XXX } |
65
|
|
|
|
|
|
|
} |
66
|
0
|
|
|
|
|
0
|
goto &$AUTOLOAD; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
require XSLoader; |
70
|
|
|
|
|
|
|
XSLoader::load('Digest::FNV', $VERSION); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Preloaded methods go here. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub fnv { |
75
|
4
|
|
|
4
|
0
|
1476
|
my ($string) = @_; |
76
|
4
|
|
|
|
|
26
|
return fnv32($string); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub fnv64 { |
80
|
4
|
|
|
4
|
0
|
2261
|
my ($string) = @_; |
81
|
4
|
|
|
|
|
32
|
my @fnv_hash = fnv64_t($string); |
82
|
|
|
|
|
|
|
#print Dumper(\@fnv_hash); print "\n"; |
83
|
|
|
|
|
|
|
|
84
|
4
|
|
|
|
|
8
|
my %hash = (); |
85
|
|
|
|
|
|
|
# This is a little test for what kind of system we're on, 32 or 64 |
86
|
4
|
|
|
|
|
5
|
if ( (1 << 32) != 4294967296) { |
87
|
|
|
|
|
|
|
$hash{'bits'} = 32; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
else { |
90
|
4
|
|
|
|
|
9
|
$hash{'bits'} = 64; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
4
|
|
|
|
|
12
|
$hash{'longlong'} = ($fnv_hash[1] << 32) | $fnv_hash[0] + 0; |
94
|
4
|
|
|
|
|
40
|
$hash{'lower'} = $fnv_hash[0]; |
95
|
4
|
|
|
|
|
7
|
$hash{'upper'} = $fnv_hash[1]; |
96
|
|
|
|
|
|
|
|
97
|
2
|
|
|
2
|
|
54472
|
use bigint; |
|
2
|
|
|
|
|
149758
|
|
|
2
|
|
|
|
|
12
|
|
98
|
4
|
|
|
|
|
81
|
my $retval = ($fnv_hash[1] << 32) | $fnv_hash[0]; |
99
|
4
|
|
|
|
|
2221
|
$hash{'bigint'} = $retval; # very likely a string |
100
|
|
|
|
|
|
|
|
101
|
4
|
|
|
|
|
20
|
return \%hash; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub fnv64a { |
105
|
4
|
|
|
4
|
0
|
1393
|
my ($string) = @_; |
106
|
4
|
|
|
|
|
18
|
my @fnv_hash = fnv64a_t($string); |
107
|
|
|
|
|
|
|
#print Dumper(\@fnv_hash); print "\n"; |
108
|
|
|
|
|
|
|
|
109
|
4
|
|
|
|
|
9
|
my %hash = (); |
110
|
|
|
|
|
|
|
# This is a little test for what kind of system we're on, 32 or 64 |
111
|
4
|
|
|
|
|
4
|
if ( (1 << 32) != 4294967296) { |
112
|
|
|
|
|
|
|
$hash{'bits'} = 32; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
else { |
115
|
4
|
|
|
|
|
8
|
$hash{'bits'} = 64; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
4
|
|
|
|
|
10
|
$hash{'longlong'} = ($fnv_hash[1] << 32) | $fnv_hash[0] + 0; |
119
|
4
|
|
|
|
|
7
|
$hash{'lower'} = $fnv_hash[0]; |
120
|
4
|
|
|
|
|
6
|
$hash{'upper'} = $fnv_hash[1]; |
121
|
|
|
|
|
|
|
|
122
|
2
|
|
|
2
|
|
366759
|
use bigint; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
10
|
|
123
|
4
|
|
|
|
|
13
|
my $retval = ($fnv_hash[1] << 32) | $fnv_hash[0]; |
124
|
4
|
|
|
|
|
1637
|
$hash{'bigint'} = $retval; # very likely a string |
125
|
|
|
|
|
|
|
|
126
|
4
|
|
|
|
|
15
|
return \%hash; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |
132
|
|
|
|
|
|
|
__END__ |