New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
binascii.crc_hqx() implements CRC-CCITT #73190
Comments
If I had known this it would have saved me getting a separate implementation working. >>> hex(binascii.crc_hqx(b"\x01", 0))
'0x1021'
https://files.stairways.com/other/binhex-40-specs-info.txt Documenting this might helped many other people. Top Google hits seem oblivious to crc_hqx(), using other CRC implementations, and even other helper functions from the binascii module: https://pypi.python.org/pypi/crc16 |
If document the polynomial for crc_hqx, maybe document it for crc32 and adler32? Wouldn't be better to write the formula as *x*\ :sup:`16` + *x*\ :sup:`12 + *x*\ :sup:`5` + 1 ? |
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'
# 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. |
Okay, then the patch LGTM. Use the form of the polynomial that you prefer. |
New changeset a33472f8a2c6 by Martin Panter in branch '3.5': New changeset 52db2072e88b by Martin Panter in branch '3.6': New changeset 3af3702b2f0a by Martin Panter in branch 'default': New changeset 5ae6102270df by Martin Panter in branch '2.7': |
Thanks for the help Serhiy |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: