CRC32 in binascii.crc32 outputs variable checksum length: 8-9-10 digits

583 views Asked by At

Is it correct behavior that binascii.crc32 outputs different checksum lengths: sometimes 8 digits, sometimes 9 or 10. I use it for an array of bytes: <700 bytes.

The code:

print(binascii.crc32(array_of_bytes))

Results:

3844368964
1383389069
132823901
3963271002
620395401
596927826
706646509
1571319956
243595751
908768330
1

There are 1 answers

0
Mark Adler On BEST ANSWER

Yes, it is correct behavior. All of them are 32-bits long. Just some have more zeros in the most significant bits. On average, 23% of them will be nine digits or shorter. 2.3% will be eight digits or shorter.