XOR checksum of four bytes — parity and checksum

exam standardthe weakest useful checksum

Answer

00010000

Why this example is worth doing

XORing all the bytes together gives a one-byte longitudinal redundancy check — cheap, and used in simple serial protocols. It is also weak in a specific and predictable way: it cannot detect reordering at all, because XOR is commutative, and it misses any error that flips the same bit position in two bytes. The page names those blind spots explicitly rather than presenting it as adequate.

Try your own input in the Parity & checksum. Even and odd parity, one’s-complement sums and the Internet checksum, step by step.

How the answer is reached

Column by column

A10110110

B01101101

C11010010

D00011001

result00010000

Column by column — columns bit, A, B, C, D, result
bitABCDresult
710100
601100
511000
410111
301010
211000
110100
001010

Compare with

Open the Parity & checksum

This input is entered in the tool itself — it is too rich for a link to carry.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • The parity bit is appended after the data bits, and a checksum is stated with the byte order it was summed in.

Sources

  • Hamming, “Error Detecting and Error Correcting Codes” (1950)
  • Braden, Borman and Partridge, RFC 1071, “Computing the Internet Checksum” (1988)