ICRAR / crc32c

A python package implementing the crc32c algorithm in hardware and software
GNU Lesser General Public License v2.1
41 stars 25 forks source link

CRC32 calculation correct? #23

Closed marco74 closed 3 years ago

marco74 commented 3 years ago

When comparing to other algorithms the result differs. Am I doing anything wrong?

>>> import crc32c
>>> import zlib
>>> zlib.crc32(b'\x01\x02\x03')
1438416925
>>> crc32c.crc32c(b'\x01\x02\x03')
4046516766
rtobar commented 3 years ago

@marco74 yes, that's expected. zlib computes the CRC-32, while this package computes CRC-32C. The algorithm is the same, but the starting polynomial is different. For details see https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Polynomial_representations_of_cyclic_redundancy_checks

marco74 commented 3 years ago

@rtobar Thank you for the clarification.