15 Star 128 Fork 41

OpenBrother / pzstudio

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CRC计算.py 385 Bytes
一键复制 编辑 原始数据 按行查看 历史
starraiser 提交于 2022-10-17 02:37 . add CRC计算.py.
def getCRC(x,invert=True):
a = 0xFFFF
b = 0xA001
tmp = 0
for byte in x:
a ^= byte
for i in range(8):
last = a % 2
a >>= 1
if last == 1:
a ^= b
if invert == True:
tmp |= 0xff & a >> 8
tmp |= a << 8 & 0xff00
else:
tmp = a
return tmp.to_bytes(2, 'big')
1
https://gitee.com/Open-Brother/pzstudio.git
git@gitee.com:Open-Brother/pzstudio.git
Open-Brother
pzstudio
pzstudio
master

搜索帮助