If you need to compute HMACs, Perl gets you covered.

In previous post HMAC we took a brief look at HMACs:

In cryptography, an HMAC (sometimes expanded as either keyed-hash message authentication code or hash-based message authentication code) is a specific type of message authentication code (MAC) involving a cryptographic hash function and a secret cryptographic key. As with any MAC, it may be used to simultaneously verify both the data integrity and the authenticity of a message.

So, from a practical point of view… how to compute them? With Perl?!?

Module Digest::SHA has everything you need to get started. In particular, all functions whose name starts with hmac_ are coded exactly with this goal in mind. From the applicable synopsis:

use Digest::SHA qw(hmac_sha1 hmac_sha1_hex ...);
$digest = hmac_sha1($data, $key);
$digest = hmac_sha224_hex($data, $key);
$digest = hmac_sha256_base64($data, $key);

No excuses for not using HMAC when needed, or reinvent any wheel!