NAME
Crypt::RIPEMD160::MAC - Perl extension for RIPEMD-160 MAC function
SYNOPSIS
use Crypt::RIPEMD160::MAC;
$key = "This is the secret key";
$mac = Crypt::RIPEMD160::MAC->new($key);
$mac->reset();
$mac->add(LIST);
$mac->addfile(HANDLE);
$digest = $mac->mac();
$string = $mac->hexmac();
DESCRIPTION
The Crypt::RIPEMD160::MAC module implements HMAC-RIPEMD-160 message authentication codes as described in RFC 2104. It uses Crypt::RIPEMD160 as the underlying hash function.
A new MAC context is created with new, passing the secret key as argument. Data is fed into the context with add (which accepts a list of strings) or addfile (which reads from a file handle). The final MAC value is returned by mac as a 20-byte binary string, or by hexmac as a human-readable hex string.
Note that both mac and hexmac are destructive operations that clear the key material. To compute another MAC, create a new context or call reset.
EXAMPLES
use Crypt::RIPEMD160::MAC;
$mac = Crypt::RIPEMD160::MAC->new("secret key");
$mac->add("some data");
$digest = $mac->mac();
print("MAC is " . unpack("H*", $digest) . "\n");
AUTHOR
The RIPEMD-160 interface was written by Christian H. Geuer (christian.geuer@crypto.gun.de).
SEE ALSO
MD5(3pm) and SHA(1).