2D parity over a 4×4 block — parity and checksum

coreparity in two directions corrects

Answer

1

Why this example is worth doing

Compute parity across each row and down each column, and a single flipped bit fails exactly one row check and one column check — their intersection is the error, so the scheme corrects rather than merely detects. The page draws the block with the failing row and column highlighted and notes this is the same idea as the Hamming syndrome, arrived at geometrically and at a worse overhead.

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

Even parity of 16 bits

Data1011001011010110

Ones in the data9odd weight

Even parity: choose the bit that makes the total number of 1s even, so the parity bit equals the XOR of all data bits.

p (even)1total ones becomes 10

Codeword (parity appended)10110010110101101

Codeword (parity prepended)11011001011010110

Warning:

A single parity bit detects every odd number of bit errors and is blind to every even number. It can never correct anything: d_min = 2.

Source: R. W. Hamming, Bell System Technical Journal 29(2):147–160 (1950)

Compare with

Open this example in the Parity & checksum

The field arrives filled in with this example’s input.

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)