小山浩之 > Digest-CMAC-0.02 > Digest::CMAC

Download:
Digest-CMAC-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.02   Source   Latest Release: Digest-CMAC-0.04

NAME ^

Digest::CMAC - The One-key CBC MAC message authentication code.

SYNOPSIS ^

  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;

DESCRIPTION ^

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).

Like many block-cipher's Crypt:: modules like Crypt::Rijndael, and MIME::Base64.

METHODS ^

new
  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.

add
  $omac1->add($message,...);

The $message provided as argument are appended to the message we calculate the MAC. The return value is the $cmac object itself;

reset
  $omac1->reset;

This is just an alias for $cmac->new;

digest
  my $digest = $omac1->digest;

Return the binary authentication code for the message. The returned string will be blockcipher's block size.

hexdigest
  my $digest = $omac1->hexdigest;

Same as $cmac->digest, but will return the digest in hexadecimal form.

b64digest

Same as $omac1->digest, but will return the digest as a base64 encoded string.

SEE ALSO ^

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

AUTHOR ^

OMAC designed and analyzed by Tetsu Iwata and Kaoru Kurosawa

"Crypt::CMAC" was written by Hiroyuki OYAMA <oyama@module.jp>

COPYRIGHT AND LICENSE ^

Copyright (C) 2006 by Hiroyuki OYAMA

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.

syntax highlighting: