OT - See if you can break this code :)

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey all.

Currently i am in the process of reverse engineering a serial stream.

Basically the stream sent is always 7 bytes long.

The 1st Byte is like a header. the 3rd last and 2nd last bytes are raw data. The final byte is some sort of checksum or something on the previous 6 bytes sent.

I need to figure out how this checksum is generated and would like some help.

Below are some sample serial streams (hex)
(A0 = Non Query command)
(80 = Query command)

A0 00 00 00 82 FE DC
A0 00 00 00 84 FE DA
A0 00 00 00 FE 99 C7
A0 00 00 00 FE FA A4
80 00 00 00 FF B8 C7
A0 00 00 00 A3 FA F9
80 00 00 00 B9 75 4C
A0 00 00 00 A1 00 01
80 00 00 00 FF B8 C7
80 00 00 00 FF B4 CB
80 00 00 00 83 B4 B7
80 00 00 00 85 B4 B1
80 00 00 00 03 B4 37
A0 00 00 00 03 79 DA
A0 00 00 00 01 79 D8
A0 00 00 00 83 79 5A
A0 00 00 00 FF 70 2F
A0 00 00 00 59 70 89

Best of luck people.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That was easy. 8)

The last byte is an XOR Checksum. XOR each of the previous 6 hex bytes, in order.

Example:

Data:
A0 00 00 00 82 FE DC

A0 XOR 00 XOR 00 XOR 00 XOR 82 XOR FE = DC

What do I win? :lol: