Digest::HMAC − Keyed−Hashing for Message Authentication


 # Functional style
 use Digest::HMAC qw(hmac hmac_hex);
 $digest = hmac($data, $key, \&myhash);
 print hmac_hex($data, $key, \&myhash);
 # OO style
 use Digest::HMAC;
 $hmac = Digest::HMAC−>new($key, "Digest::MyHash");
 $digest = $hmac−>digest;
 $digest = $hmac−>hexdigest;
 $digest = $hmac−>b64digest;


HMAC is used for message integrity checks between two parties that share a secret key, and works in combination with some other Digest algorithm, usually MD5 or SHA−1 . The HMAC mechanism is described in RFC 2104.

HMAC follow the common "Digest::" interface, but the constructor takes the secret key and the name of some other simple "Digest::" as argument.

The hmac() and hmac_hex() functions and the Digest::HMAC−>new() constructor takes an optional $blocksize argument as well. The HMAC algorithm assumes the digester to hash by iterating a basic compression function on blocks of data and the $blocksize should match the byte-length of such blocks.

The default $blocksize is 64 which is suitable for the MD5 and SHA−1 digest functions. For stronger algorithms the blocksize probably needs to be increased.


Digest::HMAC_MD5, Digest::HMAC_SHA1

RFC 2104


Graham Barr <gbarr@ti.com>, Gisle Aas <gisle@aas.no>

More Linux Commands

Xutf8TextPerCharExtents(3) - obtain per-character informatio
The XmbTextPerCharExtents, XwcTextPerCharExtents and Xutf8TextPerCharExtents functions return the text dimensions of each character of the specified text, using

setmntent(3) - get file system descriptor file entry........
These routines are used to access the filesystem description file /etc/fstab and the mounted filesystem description file /etc/mtab. The setmntent() function ope

grotty(1) - groff driver for typewriter-like devices........
grotty translates the output of GNU troff into a form suitable for typewriter-like devices. Normally grotty should be invoked by using the groff command with a

gnc-fq-dump(1) (Commands - Linux manual page)..............
This program obtains information from Finance::Quote about any specified stock, and then dumps it to the screen in annotated form. This will allow someone to se

tgetent_sp(3ncurses) - curses screen-pointer extension......
This implementation can be configured to provide a set of functions which improve the ability to manage multiple screens. This feature can be added to any of th

nrand48(3) - generate uniformly distributed pseudo-random nu
These functions generate pseudo-random numbers using the linear congruential algorithm and 48-bit integer arithmetic. The drand48() and erand48() functions retu

XtAddGrab(3) - redirect user input to a modal widget........
The XtAddGrab function appends the widget (and associated parameters) to the modal cascade and checks that exclusive is True if spring_loaded is True. If these

syndaemon(1) - a program that monitors keyboard activity and
Disabling the touchpad while typing avoids unwanted movements of the pointer that could lead to giving focus to the wrong window. OPTIONS -i &lt;idle-time&gt; How man

sendmmsg(2) send multiple messages on a socket (Man Page)...
The sendmmsg() system call is an extension of sendmsg(2) that allows the caller to transmit multiple messages on a socket using a single system call. (This has

pcre16_assign_jit_stack(3) Perl-compatible regular expressio
This function provides control over the memory used as a stack at run-time by a call to pcre[16|32]_exec() with a pattern that has been successfully compiled wi

XDGAGetViewportStatus(3) - Client library for the XFree86-DG
The XFree86-DGA extension is an X server extension for allowing client programs direct access to the video frame buffer. This is a brief description of the prog

gst-device-monitor-1.0(1) Simple command line testing tool f
gst-device-monitor-1.0 is a command line tool that can be used to test GStreamers device monitoring functionality. By default it will just print a list of all d

We can't live, work or learn in freedom unless the software we use is free.