Re: Better verification: checksum vs. xor

James Harris <james.harris.1@xxxxxxxxxxxxxx> writes:

On 24 Dec, 01:44, CBFalconer <cbfalco...@xxxxxxxxx> wrote:
James Harris wrote:

I am looking for a simple way (usable on a powerful PC or a tiny
microcontroller) to verify a small amount of data of about eight

Is it better to compare the data against a checksum or an xor of
the bytes?

I would do neither.  I would compute a 16 bit CCIT crc during
transmission, and append those two bytes.  The receiver can repeat
the process and compare the crcs.  This is not sensitive to the
message length, but you will need to know it.  The chance of an
undetected error is extremely low.

There is no transmission. This will be a block of data in memory. At
the beginning of the block will be an unknown number of garbage bytes
which need to be skipped.

All values should be 8-bit only.

Do you realize that this is an entirely different problem?

Do you know at least the length of the block to be recognized?
Are your garbage bytes random?
Are the patterns to be recognized random too?

__Pascal Bourguignon__