Digest-Crc32 reviews

RSS | Module Info

Digest-Crc32 (0.01) *

Apart from the issues raised by other reviewers, note that this module failes to set the :raw IO layer within filecrc2, so it generates the wrong CRC.

String::CRC32 and Digest::CRC are recommended and seem to work fine, although String::CRC32 is faster by a factor of 1.6 when passed a file handle.

cmpthese(-10, {
'Digest::CRC' => sub {
open my $fh, '<:raw', 'rld-ctos.r00';
my $digest = Digest::CRC->new(type => 'crc32');
my $crc = $digest->hexdigest;
'String::CRC32' => sub {
open my $fh, '<:raw', 'rld-ctos.r00';
my $crc = sprintf '%08x', String::CRC32::crc32($fh);

Rate Digest::CRC String::CRC32
Digest::CRC 37.6/s -- -39%
String::CRC32 61.4/s 63% --

Digest::Crc32 / Digest-Crc32 (0.01) *

Documentation confuses CRC32 and Crc32.

Interface is object oriented without any excuse or justification.


More than 2000 times slower than the String::CRC32 module.

the following benchmark is running against a 168854 byte MP3 file:

perl -le '
use strict;
my $file = shift;
my $data = do{open my $fh, $file or die;local $/;<$fh>};
use Digest::Crc32;
use String::CRC32;
my $digcrc = Digest::Crc32->new;
use Benchmark;

DIG => sub { $digcrc->strcrc32($data) },

STR => sub { crc32($data) },
})' current/pubc/aaam.mp3


for at least 60 CPU seconds

DIG: 61 wallclock secs (60.27 usr + 0.00 sys = 60.27 CPU) @ 0.88/s (n=53)

STR: 64 wallclock secs (62.86 usr + 0.00 sys = 62.86 CPU) @ 2170.39/s (n=136431)

Digest-Crc32 (0.01) ***

What is the point of this module?

There is already a Digest::CRC module (which it refers to in the SEE ALSO section) but it says nothing about how or why this module is more appropriate than that or the several other CRC modules.

It has a negligable test (only tests the string "foo") and doesn't attempt to account for portential endianess or sign issues.