1

Can anyone manage to work out how the checksum is calculated in the following data? Have tried reverse engineering crc and xor and anything else I can think of. There is a definite pattern there, but I cant work it out.

C8 00 02
DD 01 02
53 02 02
CC 03 02
BF 04 02
65 05 02
57 06 02
FE 07 02
35 08 02
44 09 02
28 10 02
3D 11 02
B3 12 02
2C 13 02
5F 14 02
85 15 02
B7 16 02
1E 17 02
D5 18 02
A4 19 02
27 20 02
32 21 02
BC 22 02
23 23 02
50 24 02
8A 25 02
B8 26 02
11 27 02
DA 28 02
AB 29 02
39 40 02
2C 41 02
A2 42 02
3D 43 02
4E 44 02
94 45 02
A6 46 02
0F 47 02
B5 49 02
D9 50 02
CC 51 02
42 52 02
DD 53 02
AE 54 02
74 55 02
46 56 02
EF 57 02
24 58 02
55 59 02
D6 60 02
C3 61 02
4D 62 02
D2 63 02
A1 64 02
7B 65 02
49 66 02
E0 67 02
2B 68 02
5A 69 02
05 80 02
05 80 02
10 81 02
9E 82 02
01 83 02
72 84 02
A8 85 02
9A 86 02
33 87 02
F8 88 02
89 89 02
E5 90 02
F0 91 02
7E 92 02
E1 93 02
92 94 02
48 95 02
7A 96 02
D3 97 02
18 98 02
69 99 02
3E 0A 02
AC 0B 02
17 0C 02
BE 0D 02
AB 0E 02
DF 0F 02
DE 1A 02
4C 1B 02
F7 1C 02
5E 1D 02
4B 1E 02
3F 1F 02
3F 1F 02
D1 2A 02
43 2B 02
F8 2C 02
51 2D 02
44 2E 02
30 2F 02
CF 4A 02
5D 4B 02
E6 4C 02
4F 4D 02
5A 4E 02
2E 4F 02
2F 5A 02
BD 5B 02
06 5C 02
AF 5D 02
20 6A 02
B2 6B 02
09 6C 02
A0 6D 02
B5 6E 02
C1 6F 02
F3 8A 02
61 8B 02
DA 8C 02
73 8D 02
66 8E 02
12 8F 02
12 8F 02
13 9A 02
81 9B 02
3A 9C 02
93 9D 02
86 9E 02
F2 9F 02
EA A0 02
FF A1 02
71 A2 02
EE A3 02
9D A4 02
47 A5 02
75 A6 02
DC A7 02
17 A8 02
66 A9 02
1C AA 02
8E AB 02
35 AC 02
9C AD 02
89 AE 02
FD AF 02

The first item on each line is the checksum. Much appreciated!!!

I have looked further into the left and right nibble of the second byte (the last byte is unchanged at 0x02). There seem to be repeated patterns depending on the values which I highlighted in Excel: Nibble Patterns

The colours highlight where there is repeating values. Not sure if this helps!

Further testing I am pretty sure this isn't CRC based. Starting with the first value of C8, as the first nibble changes from 00 to 10, the checksum goes to 28, which is the value XORd with E0. This holds up between 01 and 11, 02 and 12, 03 and 13... it is the previous value XORd with E0. So:

C8 00 02    XOR with E0
28 10 02

DD 01 02    XOR with E0
3D 11 02

53 02 02    XOR with E0
B3 12 02

However,
28 10 02    XOR with 0F
37 20 02

3D 11 02    XOR with 0F
32 21 02

B3 12 02    XOR with 0F
BC 22 02

And:
27 20 02    XOR with 1E 
39 40 02

32 21 02    XOR with 1E 
2C 41 02

BC 22 02    XOR with 1E 
A2 22 02

Thanks again.

  • 3
    where do these come from? do you have access to the code which calculates or verifies the checksum? – Igor Skochinsky Jul 31 '19 at 18:30
  • 1
    @Lodge: Hi and welcome to RE.SE. What is the first item? First item on every line or first line of all the lines ...? – 0xC0000022L Jul 31 '19 at 20:22
  • Hi both, no I don't have access to the code, it's a checksum on a canbus system we are working on. Sorry for the confusion, on every line, the first item is the checksum and the second two are the data. Thanks. – Lodge Aug 1 '19 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.