如何在python3中计算ANSI CRC16多项式(0x8005)? [英] how to calculate ANSI CRC16 polynomial (0x8005) in python3?
本文介绍了如何在python3中计算ANSI CRC16多项式(0x8005)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用此代码计算ANSI CRC16多项式(0x8005)
I tried to calculate ANSI CRC16 polynomial (0x8005) using this code
import crcmod
crc16 = crcmod.mkCrcFun(0x8005, 0xffff, True)
但我收到了此错误消息
ValueError:多项式的阶数必须为8、16、24、32或64
ValueError: The degree of the polynomial must be 8, 16, 24, 32 or 64
推荐答案
在 0x8005 $ c $的开头有一个隐含的
1
c>
There is an implied 1
at the beginning of 0x8005
crcmod希望您明确提供 1
crcmod expects you to provide the 1
explicitly
import crcmod
crc16 = crcmod.mkCrcFun(0x18005, 0xffff, True)
这篇关于如何在python3中计算ANSI CRC16多项式(0x8005)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文