how to calculate ANSI CRC16 polynomial (0x8005) in

2019-07-24 04:09发布

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条回答
趁早两清
2楼-- · 2019-07-24 05:06

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)
查看更多
登录 后发表回答