Skip to content

Instantly share code, notes, and snippets.

@pintoXD
pintoXD / crc16_arc.py
Created April 27, 2020 11:32
CRC16/ARC Python implementation
def crc16(data, offset, length):
if data is None or offset < 0 or offset > len(data) - 1 and offset+length > len(data):
return 0
crc = 0x0000
for i in (range(0, length)):
# crc = crc << 8
crc ^= data[i]
# print(hex(data[i]))
print(bin(crc))
for j in range(0, 8):