Xor Sum


Closed Thread
Results 1 to 4 of 4

Thread: Xor Sum

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Sphere
    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.....
    Here is a simple demo of how to accomplish this in PBP:
    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]
    HTH,
    Steve

    EDIT: Corrected the DataPacket array declaration to 7 bytes
    Last edited by SteveB; - 7th December 2006 at 02:43.

  2. #2
    Join Date
    Aug 2005
    Posts
    95


    Did you find this post helpful? Yes | No

    Default Thanks alot

    Thanks alot keithdoxey and SteveB it worked first time, it will save me alot of code space.

    Thanks again Sphere.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts