Crypt::RIPEMD160::MAC(3)

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, read-once operations on the accumulated data. To compute another MAC with the same key, call reset and then add new data.

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");

LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl you may have available.

See <https://dev.perl.org/licenses/> for more information.

AUTHOR
The RIPEMD-160 interface was written by Christian H. Geuer ("christian.geuer@crypto.gun.de").

SEE ALSO
Crypt::RIPEMD160