I need to understand how to work out a checksum for this A0 00 00 04 20 00 AF, the answer is 2B but I dont understand how to work out an XOR sum. According to the website I got this from, its says 2B is an XOR sum of Bytes 1-7.
Sphere.....
Printable View
I need to understand how to work out a checksum for this A0 00 00 04 20 00 AF, the answer is 2B but I dont understand how to work out an XOR sum. According to the website I got this from, its says 2B is an XOR sum of Bytes 1-7.
Sphere.....
Just start with byte 1 and XOR each of the following bytes.
The sequence works like this...
A0
XOR 00 = A0
XOR 00 = A0
XOR 04 = A4
XOR 20 = 84
XOR 00 = 84
XOR AF = 2B
Here is a simple demo of how to accomplish this in PBP:Quote:
Originally Posted by Sphere
HTH,Code:DataPacket var byte[7]
XORsum var byte
DataPacket[0] = A0
DataPacket[1] = 00
DataPacket[2] = 00
DataPacket[3] = 04
DataPacket[4] = 20
DataPacket[5] = 00
DataPacket[6] = AF
XORsum = DataPacket[0] ^ DataPacket[1]
XORsum = XORsum ^ DataPacket[2]
XORsum = XORsum ^ DataPacket[3]
XORsum = XORsum ^ DataPacket[4]
XORsum = XORsum ^ DataPacket[5]
XORsum = XORsum ^ DataPacket[6]
Steve
EDIT: Corrected the DataPacket array declaration to 7 bytes
Thanks alot keithdoxey and SteveB it worked first time, it will save me alot of code space.
Thanks again Sphere.