"Fossies" - the Fresh Open Source Software Archive 
Member "Digest-HMAC-1.04/lib/Digest/HMAC_SHA1.pm" (1 Apr 2021, 1289 Bytes) of package /linux/privat/Digest-HMAC-1.04.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "HMAC_SHA1.pm" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
1.03_vs_1.04.
1 package Digest::HMAC_SHA1;
2 our $VERSION = '1.04'; # VERSION
3 our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY
4
5 use strict;
6 use Digest::SHA qw(sha1);
7 use Digest::HMAC qw(hmac);
8
9 # OO interface
10 use vars qw(@ISA);
11 @ISA=qw(Digest::HMAC);
12 sub new
13 {
14 my $class = shift;
15 $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 use vars qw(@EXPORT_OK);
22 @EXPORT_OK=qw(hmac_sha1 hmac_sha1_hex);
23
24 sub hmac_sha1
25 {
26 hmac($_[0], $_[1], \&sha1, 64);
27 }
28
29 sub hmac_sha1_hex
30 {
31 unpack("H*", &hmac_sha1)
32 }
33
34 1;
35
36 __END__
37
38 =head1 NAME
39
40 Digest::HMAC_SHA1 - Keyed-Hashing for Message Authentication
41
42 =head1 SYNOPSIS
43
44 # Functional style
45 use Digest::HMAC_SHA1 qw(hmac_sha1 hmac_sha1_hex);
46 $digest = hmac_sha1($data, $key);
47 print hmac_sha1_hex($data, $key);
48
49 # OO style
50 use Digest::HMAC_SHA1;
51 $hmac = Digest::HMAC_SHA1->new($key);
52
53 $hmac->add($data);
54 $hmac->addfile(*FILE);
55
56 $digest = $hmac->digest;
57 $digest = $hmac->hexdigest;
58 $digest = $hmac->b64digest;
59
60 =head1 DESCRIPTION
61
62 This module provide HMAC-SHA-1 hashing.
63
64 =head1 SEE ALSO
65
66 L<Digest::HMAC>, L<Digest::SHA>, L<Digest::HMAC_MD5>
67
68 =head1 MAINTAINER
69
70 Andrew Rodland <arodland@cpan.org>
71
72 =head1 ORIGINAL AUTHOR
73
74 Gisle Aas <gisle@aas.no>
75
76 =cut