Skip Menu |

This queue is for tickets about the Digest-HMAC CPAN distribution.

Report information
The Basics
Id: 14551
Status: resolved
Priority: 0/
Queue: Digest-HMAC

People
Owner: Nobody in particular
Requestors: mshelor [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Block-Size Argument not Documented in POD
Hi Gisle, The "new", "hmac", and "hmac_hex" functions take an optional block_size argument as the final parameter. However, this argument isn't documented in the POD for Digest::HMAC; rather, it's necessary to study the module code to discover it. The following program illustrates why the block_size parameter is critical when using stronger hash algorithms such as SHA-384/512: ################################################### use strict; use warnings; use Digest::SHA qw(sha384 hmac_sha384_hex); use Digest::HMAC qw(hmac_hex); my $key = "she who must be obeyed"; my $data = "go to the window"; my ($r1, $r2); $r1 = hmac_sha384_hex($data, $key); $r2 = hmac_hex($data, $key, \&sha384); print "$r1\n$r2 ... ", $r1 eq $r2 ? "ok" : "not ok", "\n"; $r1 = hmac_sha384_hex($data, $key); $r2 = hmac_hex($data, $key, \&sha384, 128); print "$r1\n$r2 ... ", $r1 eq $r2 ? "ok" : "not ok", "\n"; ################################################### Perhaps the Digest module could introduce something like a "blocksize" method so that all conforming modules could be written to automatically supply this information. Just a thought. Regards, Mark
Better late than never :-) The 1.03 release documents this argument. Having the Digest::* implementations declare a blocksize as a class method would probably be a good idea, but I'm not sure I want to promote it at this point. Are there other algorithms than HMAC that would find this information useful? It's also problematic how this would work with the generic functional interface where you just provide a digester function.