问题
I tried to calculate ANSI CRC16 polynomial (0x8005) using this code
import crcmod
crc16 = crcmod.mkCrcFun(0x8005, 0xffff, True)
but I got this error message
ValueError: The degree of the polynomial must be 8, 16, 24, 32 or 64
回答1:
There is an implied 1
at the beginning of 0x8005
crcmod expects you to provide the 1
explicitly
import crcmod
crc16 = crcmod.mkCrcFun(0x18005, 0xffff, True)
来源:https://stackoverflow.com/questions/24851027/how-to-calculate-ansi-crc16-polynomial-0x8005-in-python3