No description, website, or topics provided.
Perl 6
Switch branches/tags
Nothing to show
Clone or download
Latest commit dcc292d Apr 26, 2018
Permalink
Failed to load latest commit information.
lib/Digest Add unit declarator to module declarations May 21, 2015
t Add tests, require Digest for testing Apr 17, 2014
.travis.yml fix travis Apr 26, 2018
LICENSE Initial commit Apr 11, 2014
META6.json Use modern META filename Apr 25, 2017
README.md Documentation! Apr 17, 2014

README.md

P6-Digest-HMAC

Example Usage

use Digest::HMAC;
use Digest;

my Buf $hmac = hmac($key, $data, &md5);
my Str $hmac = hmac-hex($key, $data, &md5);

Functions

  • sub hmac-hex($key, $data, Callable &hash, $blocksize = 64 --> Str)

    Returns the hex stringified output of hmac.

  • sub hmac($key, $data, Callable &hash, $blocksize = 64 --> Buf)

    Computes the HMAC of the passed information.

    $key and $data can either be Str or Blob objects; if they are Str they will be encoded as ascii.

    &hash needs to be a hash function that takes and returns a Blob or Buf. If it operates on or returns a Str, it will not work. (The md5, sha1, sha256 functions from Digest work well, as in the example above)

    $blocksize is the block size of the hash function. 64 is the default, and is correct for at least md5, sha1, sha256.