如何在python3中计算ANSI CRC16多项式(0x8005)?

Gra*_*ray 2 python crc python-3.x crc16

我尝试使用此代码计算ANSI CRC16多项式(0x8005)

import crcmod
crc16 = crcmod.mkCrcFun(0x8005, 0xffff, True)
Run Code Online (Sandbox Code Playgroud)

但我收到此错误消息

ValueError:多项式的阶数必须为8、16、24、32或64

Joh*_*ooy 5

1开头有一个隐含0x8005

crcmod希望您提供1明确的

import crcmod
crc16 = crcmod.mkCrcFun(0x18005, 0xffff, True)
Run Code Online (Sandbox Code Playgroud)