1Digest::HMAC(3) User Contributed Perl Documentation Digest::HMAC(3)
2
3
4
6 Digest::HMAC - Keyed-Hashing for Message Authentication
7
9 # Functional style
10 use Digest::HMAC qw(hmac hmac_hex);
11 $digest = hmac($data, $key, \&myhash);
12 print hmac_hex($data, $key, \&myhash);
13
14 # OO style
15 use Digest::HMAC;
16 $hmac = Digest::HMAC->new($key, "Digest::MyHash");
17
18 $hmac->add($data);
19 $hmac->addfile(*FILE);
20
21 $digest = $hmac->digest;
22 $digest = $hmac->hexdigest;
23 $digest = $hmac->b64digest;
24
26 HMAC is used for message integrity checks between two parties that
27 share a secret key, and works in combination with some other Digest
28 algorithm, usually MD5 or SHA-1. The HMAC mechanism is described in
29 RFC 2104.
30
31 HMAC follow the common "Digest::" interface, but the constructor takes
32 the secret key and the name of some other simple "Digest::" as
33 argument.
34
36 Digest::HMAC_MD5, Digest::HMAC_SHA1
37
38 RFC 2104
39
41 Graham Barr <gbarr@ti.com>, Gisle Aas <gisle@aas.no>
42
43
44
45perl v5.12.0 2010-01-10 Digest::HMAC(3)