S
@gertjanvanhethof
I have a DALLAS 1Wire implementation.
I'm sure you can find look up values to change it to the CRC8 you require.
def crc8Nib (data):
#'''
CRC8_TABLE_SML1 = bytes([0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41])
CRC8_TABLE_SML2 = bytes([0x00, 0x9d, 0x23, 0xbe, 0x46, 0xdb, 0x65, 0xf8, 0x8c, 0x11, 0xaf, 0x32, 0xca, 0x57, 0xe9, 0x74])
#'''
try:
crc = 0xFF # 0xFF seeded
for x in data:
t = (x ^ crc) & 0xFF
crc = CRC8_TABLE_SML1[t & 0x0f] ^ CRC8_TABLE_SML2[t >> 4]
return crc;
except ValueError:
pass