0

I'm trying to reverse engineer serial protocol, everything seems straightforward, except checksum byte. Seems to be some easy algorithm - when sum of all bytes is the same, checksum/crc stays the same. But still can not figure exact algorithm:

Last byte is Checksum.

80,6F,A3,01,02,B0,08,18
80,6F,A3,03,00,80,00,40
80,6F,A3,02,00,80,00,41
80,6F,A3,04,00,80,00,43
80,6F,A3,01,01,81,08,48
80,6F,A3,01,02,80,08,48
80,6F,A3,01,00,81,08,49
80,6F,A3,01,04,80,08,4A
80,6F,A3,01,00,80,08,4E
80,6F,A3,01,02,A0,08,68
80,6F,A3,01,01,A2,08,6B
80,6F,A3,01,02,88,08,70
80,6F,A3,01,06,80,08,74
80,6F,A3,01,00,88,08,76
80,6F,A3,01,02,90,08,78
80,6F,A3,01,12,80,08,78

responses:

10,03,A3,00,01,00,38,06,73,9C,9B,94,00,12,12,02
10,03,A3,00,01,00,38,0A,74,A0,8E,94,00,12,12,06
10,03,A3,00,01,00,40,06,72,9E,99,94,00,12,12,0B
10,03,A3,00,01,00,30,07,72,9B,9A,8E,00,12,12,12
10,03,A3,00,01,00,38,04,74,77,78,CC,01,12,12,12
10,03,A3,00,01,00,30,07,71,9B,99,90,00,12,12,12
10,03,A3,00,01,00,30,07,6F,9F,92,94,00,12,12,13
10,03,A3,00,01,00,30,07,6E,A1,8C,94,00,12,12,14
10,03,A3,00,01,00,30,07,6E,A0,8E,94,00,12,12,17
10,03,A3,00,01,00,30,07,72,9B,9A,90,00,12,12,1C
10,03,A3,00,01,00,30,06,72,A1,91,94,00,12,12,1C
10,03,A3,00,01,00,30,07,72,9B,99,90,00,12,12,1D
10,03,A3,00,01,00,30,07,70,9C,98,94,00,12,12,1F
10,03,A3,00,01,00,38,05,74,76,77,00,00,12,12,2C
10,03,A3,00,01,00,B4,03,6C,3E,3A,00,00,12,00,31
10,03,A3,00,01,00,30,06,72,72,71,00,00,12,12,33

First byte stays the same, not sure if I should count with them into checksum.

All help appreciated.

3

did not check the second set

but your first set appears to be xorred by 0x55

0x55 ^ 0x18 == 0x4d (8 bit checksum )

edit

ok my guess was right here is a python script that prints the chksum using the data copy pasted to a text file

infile = open("timepass.txt" , "r")
while True:
    line = infile.readline()
    a = line.split(",")
    sum = 0x0;
    for i in range(0,len(a)-1,1):
        sum = sum + int(a[i],16)
    if not line:
        break
    print hex( ((sum % 0x100) ^ 0x55) ),
infile.close()

here is the result

C:\>python chksum.py
0x18 0x40 0x41 0x43 0x48 0x48 0x49 0x4a 
0x4e 0x68 0x6b 0x70 0x74 0x76 0x78 0x78 
0x2 0x6 0xb 0x12 0x12 0x12 0x13 0x14 
0x17 0x1c 0x1c 0x1d 0x1f 0x2c 0x31 0x33

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.