File Coverage

blib/lib/Digest/HMAC_SHA1.pm
Criterion Covered Total %
statement 18 19 94.7
branch n/a
condition n/a
subroutine 7 8 87.5
pod 0 3 0.0
total 25 30 83.3


line stmt bran cond sub pod time code
1             package Digest::HMAC_SHA1;
2             $VERSION="1.03";
3              
4 1     1   720 use strict;
  1         1  
  1         44  
5 1     1   106969 use Digest::SHA qw(sha1);
  1         66986  
  1         144  
6 1     1   15 use Digest::HMAC qw(hmac);
  1         2  
  1         50  
7              
8             # OO interface
9 1     1   5 use vars qw(@ISA);
  1         2  
  1         243  
10             @ISA=qw(Digest::HMAC);
11             sub new
12             {
13 7     7 0 155 my $class = shift;
14 7         27 $class->SUPER::new($_[0], "Digest::SHA", 64); # Digest::SHA defaults to SHA-1
15             }
16              
17             # Functional interface
18             require Exporter;
19             *import = \&Exporter::import;
20 1     1   7 use vars qw(@EXPORT_OK);
  1         3  
  1         618  
21             @EXPORT_OK=qw(hmac_sha1 hmac_sha1_hex);
22              
23             sub hmac_sha1
24             {
25 7     7 0 202 hmac($_[0], $_[1], \&sha1, 64);
26             }
27              
28             sub hmac_sha1_hex
29             {
30 0     0 0   unpack("H*", &hmac_sha1)
31             }
32              
33             1;
34              
35             __END__