Skip Menu |

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

Report information
The Basics
Id: 120282
Status: resolved
Priority: 0/
Queue: Digest-CRC

People
Owner: OLIMAUL [...] cpan.org
Requestors: DBOOK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.05
Fixed in: 0.22



Subject: crc*_hex functions do not pad digits
A hex representation of a CRC32 hash is expected to be 8 hex digits. However if the leading digits are zeroes they are omitted, due to _encode_hex running a simple sprintf without padding. $ perl -MDigest::CRC=crc32_hex -E'say crc32_hex shift' ad 77e0ed58 $ perl -MDigest::CRC=crc32_hex -E'say crc32_hex shift' ae e7ddce The functions crc_hex, crc8_hex, crc16_hex, crc32_hex, crcccitt_hex, and crcopenpgparmor_hex are affected by this, as well as the ->hexdigest OO method. The expected width should probably be passed to _encode_hex, so that it can pad the value correctly.
Hi, thanks for the information. I added the padding logik for hex formated digests to version 0.22 which is being released within the next hours. Regards, Oliver