Digest::HMAC_SHA1 β KeyedβHashing for Message Authentication
| Use Case | Command | Description |
|---|---|---|
| Compute HMACβSHAβ1 digest (binary) | hmac_sha1($data, $key) | Functional style β returns raw bytes |
| Compute HMACβSHAβ1 hex digest | hmac_sha1_hex($data, $key) | Functional style β returns hexadecimal string |
| OO style β create HMAC object | Digest::HMAC_SHA1->new($key) | Returns a new HMAC object with given key |
| OO style β add data | $hmac->add($data) | Feed data to the HMAC computation |
| OO style β add file | $hmac->addfile(*FILE) | Feed data from a filehandle |
| OO style β get binary digest | $hmac->digest | Returns raw binary digest |
| OO style β get hex digest | $hmac->hexdigest | Returns hexadecimal string |
| OO style β get base64 digest | $hmac->b64digest | Returns Base64 encoded string |
# Functional style
use Digest::HMAC_SHA1 qw(hmac_sha1 hmac_sha1_hex);
$digest = hmac_sha1($data, $key);
print hmac_sha1_hex($data, $key);
# OO style
use Digest::HMAC_SHA1;
$hmac = Digest::HMAC_SHA1->new($key);
$hmac->add($data);
$hmac->addfile(*FILE);
$digest = $hmac->digest;
$digest = $hmac->hexdigest;
$digest = $hmac->b64digest;
This module provides HMACβSHAβ1 hashing.
Andrew Rodland <arodland AT cpan.org>
Gisle Aas <gisle AT aas.no>
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-06 08:51 @216.73.216.52
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)