1

I need to find relations last byte with others. Tried these solutions, but it didn't work.

My tries: * When I write all datas as binary, 1's count not equal but last byte same for some datas. * When I sum all datas and divide by 3 or 4, it equals to last byte, but for future, maybe it's not stable.

Bunch of data:

FC 41 01 30 10 01 21 00 01 00 00 00 00 00 00 00 00 00 00 00 00 5B
FC 41 01 30 10 01 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5C

FC 41 01 30 10 01 24 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 4A
FC 41 01 30 10 01 24 00 00 00 0E 00 00 00 00 00 00 00 00 00 00 4B
FC 41 01 30 10 01 24 00 00 00 0B 00 00 00 00 00 00 00 00 00 00 4E
FC 41 01 30 10 01 24 00 00 00 07 00 00 00 00 00 00 00 00 00 00 52
FC 41 01 30 10 01 24 00 00 00 06 00 00 00 00 00 00 00 00 00 00 53
FC 41 01 30 10 01 24 00 00 00 01 00 00 00 00 00 00 00 00 00 00 58
FC 41 01 30 10 01 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 59

FC 41 01 30 10 01 22 00 00 01 00 00 00 00 00 00 00 00 00 00 00 5A
FC 41 01 30 10 01 22 00 00 03 00 00 00 00 00 00 00 00 00 00 00 58
FC 41 01 30 10 01 22 00 00 07 00 00 00 00 00 00 00 00 00 00 00 54
FC 41 01 30 10 01 22 00 00 02 00 00 00 00 00 00 00 00 00 00 00 59

FC 62 01 30 10 03 00 00 0D 00 00 AF 00 00 00 00 00 00 00 00 00 9E
FC 62 01 30 10 03 00 00 0F 00 00 B2 00 00 00 00 00 00 00 00 00 99
FC 62 01 30 10 03 00 00 10 00 00 B4 00 00 00 00 00 00 00 00 00 96
FC 62 01 30 10 03 00 00 11 00 00 B6 00 00 00 00 00 00 00 00 00 93
FC 62 01 30 10 03 00 00 11 00 00 B7 00 00 00 00 00 00 00 00 00 92
FC 62 01 30 10 03 00 00 12 00 00 B9 00 00 00 00 00 00 00 00 00 8F
FC 62 01 30 10 03 00 00 12 00 00 B8 00 00 00 00 00 00 00 00 00 90
FC 62 01 30 10 03 00 00 13 00 00 BA 00 00 00 00 00 00 00 00 00 8D
FC 62 01 30 10 03 00 00 14 00 00 BD 00 00 00 00 00 00 00 00 00 89
FC 62 01 30 10 03 00 00 15 00 00 BE 00 00 00 00 00 00 00 00 00 87
FC 62 01 30 10 03 00 00 16 00 00 C0 00 00 00 00 00 00 00 00 00 84
FC 62 01 30 10 03 00 00 1C 00 00 D0 00 00 00 00 00 00 00 00 00 6E 

Thank you,

M.

1

If you ignore the first constant byte (FC), all the other bytes add up to 00, ignoring overflow.

In other words, to calculate the last byte, start with 00, subtract all bytes except the first FC (and the last one, obviously). Ignore underflow. The result is the last byte. Or, if that's easier in your programming language, start with 2000 (8192 decimal), subtract all bytes, and AND the result with FF.

  • if your choice of language is powershell you can use this>cat checksum.ps1 $c=(gc .\checksumthis.txt);$s="";0..($c.length-1)|%{$t=0;$l=-split $c[$_]; $l[1..($l.Length-2)]|%{$t+=[convert]::ToSByte($_,16)};$s+="{0:X} "-f(256-$t)} $s >powershell -nologo -f .\checksum.ps1 5B 5C 4A 4B 4E 52 53 58 59 5A 58 54 59 9E 99 96 93 92 8F 90 8D 89 87 84 6E – blabb Oct 7 '15 at 17:50
  • how did you find this solution? Could you please explain? – mcan Oct 7 '15 at 21:23
  • @mcan: Looking at the sequences where only one byte changes, i noticed every payload change by some amount corresponds with a checksum change by the negative amount. (01-5B, 00-5C and 0F-4A, 0E-4B, 0B-4E...) This made me think "constant sum". Then i summed up some of the rows using my trusty hex calculator, and got FC (plus some overflow) in every case. That was it. – Guntram Blohm supports Monica Oct 8 '15 at 8:40

Your Answer

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

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