Digest::CMAC - The One-key CBC MAC message authentication code.
use Digest::CMAC; my $omac1 = Digest::CMAC->new($key); $omac1->add($data); my $binary_tag = $omac1->digest; my $hex_tag = $omac1->hexdigest; my $base64_tag = $omac1->b64digest;
This module implements OMAC1 blockcipher-based message authentication code for perl. For OMAC1/OMAC. Check http://www.nuee.nagoya-u.ac.jp/labs/tiwata/omac/omac.html. Here is an excerpt of that page
OMAC is a blockcipher-based message authentication code designed and analyzed by me and Kaoru Kurosawa.
OMAC is a simple variant of the CBC MAC (Cipher Block Chaining Message Authentication Code). OMAC stands for One-Key CBC MAC.
OMAC allows and is secure for messages of any bit length (while the CBC MAC is only secure on messages of one fixed length, and the length must be a multiple of the block length). Also, the efficiency of OMAC is highly optimized. It is almost as efficient as the CBC MAC.
"NIST Special Publication 800-38B Recommendation for Block Cipher Modes of Operation: the CMAC Mode for Authentication" has been finalized on May 18, 2005. This Recommendation specifies CMAC, which is equivalent to OMAC (OMAC1).
my $omac1 = Digest::CMAC->new($key [, $cipher]);
This creates a new Digest::CMAC object, using $key.
$cipher is 'Crypt::Rijndael'(default), 'Crypt::Misty1', Crypt::Blowfish', or whatever blockcipher you like. $key is fixed length string that blockcipher demands.
The $message provided as argument are appended to the message we calculate the MAC. The return value is the $cmac object itself;
This is just an alias for $cmac->new;
my $digest = $omac1->digest;
Return the binary authentication code for the message. The returned string will be blockcipher's block size.
my $digest = $omac1->hexdigest;
Same as $cmac->digest, but will return the digest in hexadecimal form.
Same as $omac1->digest, but will return the digest as a base64 encoded string.
Crypt::Rijndael, http://www.nuee.nagoya-u.ac.jp/labs/tiwata/omac/omac.html, http://www.csrc.nist.gov/publications/nistpubs/800-38B/SP_800-38B.pdf
OMAC designed and analyzed by Tetsu Iwata and Kaoru Kurosawa
"Crypt::CMAC" was written by Hiroyuki OYAMA <firstname.lastname@example.org>
OMAC2 support added by Yuval Kogman
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Hiroyuki OYAMA, 2007 by Hiroyuki OYAMA, Yuval Kogman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 51:
=back doesn't take any parameters, but you said =back 4