[docs] [issue29004] binascii.crc_hqx() implements CRC-CCITT

Martin Panter report at bugs.python.org
Sun Dec 18 06:47:52 EST 2016

Martin Panter added the comment:

It seems I can write it without the escaped spaces. Is there a problem with this:

*x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1

I’m happy to add the CRC-32 polynomial if you think it would be useful, although it is a lot longer (fifteen terms instead of four). And this CRC is already easily identified by the CRC-32 name. As well as the polynomial, there are other details that identify a CRC. The bits in CRC-32 are reversed and inverted compared to CRC-CCITT.

>>> hex(crc32(b"\x80", 0xFFFFFFFF) ^ 0xFFFFFFFF)
# 0xEDB88320 is the reversed polynomial representation; the x^0 term corresponds to bit 31

Adler32 is not a CRC, and I don’t think there are multiple versions of the algorithm, so I don’t think it would need any special explanation.


Python tracker <report at bugs.python.org>

More information about the docs mailing list