添加crc8算法
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user