line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Digest::HMAC_SHA1; |
2
|
|
|
|
|
|
|
our $VERSION = '1.04'; # VERSION |
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
421
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
6
|
1
|
|
|
1
|
|
498
|
use Digest::SHA qw(sha1); |
|
1
|
|
|
|
|
2761
|
|
|
1
|
|
|
|
|
77
|
|
7
|
1
|
|
|
1
|
|
6
|
use Digest::HMAC qw(hmac); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
48
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# OO interface |
10
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
11
|
|
|
|
|
|
|
@ISA=qw(Digest::HMAC); |
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
7
|
|
|
7
|
0
|
100
|
my $class = shift; |
15
|
7
|
|
|
|
|
19
|
$class->SUPER::new($_[0], "Digest::SHA", 64); # Digest::SHA defaults to SHA-1 |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Functional interface |
19
|
|
|
|
|
|
|
require Exporter; |
20
|
|
|
|
|
|
|
*import = \&Exporter::import; |
21
|
1
|
|
|
1
|
|
5
|
use vars qw(@EXPORT_OK); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
120
|
|
22
|
|
|
|
|
|
|
@EXPORT_OK=qw(hmac_sha1 hmac_sha1_hex); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub hmac_sha1 |
25
|
|
|
|
|
|
|
{ |
26
|
7
|
|
|
7
|
0
|
95
|
hmac($_[0], $_[1], \&sha1, 64); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub hmac_sha1_hex |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
0
|
0
|
|
unpack("H*", &hmac_sha1) |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |