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.