> > It seems like adding would be better than XORing because I'm > > "spreading" the information within the 8 bits by the carries > > In the meantime, however, I can touch very briefly on the > addition-modulo-256 (ADD) vs. addition-modulo-2 (XOR) issue. > > Dan: You're correct when you say that adding "spreads the > information". Unfortunately, it only spreads it LEFTWARD (i.e., > toward the MSB)... Assuming that your checksum is no wider than > each of your information words, the most-significant bit of each > information word only affects (at best) the most-significant bit > of the checksum. There are a number of easy improvements to get around this problem; swapf'ing the checksum after every byte, for example, would allow changes in bit 7 to result in changes to bit 4. The amount of spreading, however, really is pretty small. Further, the carry-bit propagation makes it much harder to do any substantive analysis of checksums' effectiveness that an XORsum or CRC's. > Unless you know that the errors are more likely to occur in the > least-significant bits of your information words, there's no > real advantage to ADDing over XORing. Data should be checksum/crc'ed/whatever in whatever base was used in its transmission. If the transmission takes pairs of bits and converts them into tones (and the same bit positions are always paired) then it probably makes sense to compute checksums on each 2-bit group. Since most communication is binary, however, base-2 operations are probably best. > Also, while both techniques will always detect a single error > and both can be fooled by two-bit errors, only the XOR method > will always detect all 3-bit errors (in fact, it'll detect ALL > errors that involve an odd number of bits). This is a point I'd not considered; I expect, however, that in practice a checksum and xorsum are about equal in terms of what they'll detect/correct while a CRC (though a little harder to implement) is much better.