Bitwise XOR of all characters in string
Posted on 2006-10-25
I'm trying to read NMEA gps signal from COM1, modifying it and sending it out on COM2. In this case I need to check the chekcsum of the incoming signal, and generate a checksum for the new modified data stream.
The incoming data is like this
I need to do this
a XOR b XOR c XOR , XOR d (...) XOR k XOR l
i.e. XOR all characters between $ and *
Then the checksum is the hexadesimal value typed at the end of the string e.g. FF
What is the fastest and most efficient way of doing this? I don't mind putting ASM code in the project if that will be the most efficient and elegant.