添加crc8算法

This commit is contained in:
andy
2024-04-18 22:58:31 +08:00
parent 08bdc1ddaa
commit fdcee878ea

View File

@@ -10,7 +10,17 @@ from PyQt5.QtCore import *
def crc8(data:bytearray):
crc=0
for j in range(len(data)):
crc^=data[j]
for i in range(8):
if((crc&0x01)!=0):
crc>>=1
crc^=0x8c
else:
crc>>=1
return crc