Skip to main content
networking

Hamming Code

Hamming codes are error-correcting codes that can detect 2-bit errors and correct 1-bit errors by placing parity bits at power-of-2 positions. ECC RAM uses Hamming(72,64) – 64 data bits with 8 check bits. The Hamming distance between two codewords determines error detection and correction capability.

Definition

Hamming codes position parity bits at positions 1, 2, 4, 8, 16... (powers of 2). Each parity bit covers a specific subset of data bits determined by the binary representation of positions. When a bit flips, the combination of failed parity checks reveals the exact position of the error, enabling automatic correction. Hamming(7,4) encodes 4 data bits with 3 parity bits and corrects any single-bit error. SECDED (Single Error Correction, Double Error Detection) adds an overall parity bit to detect (but not correct) 2-bit errors. ECC server RAM uses Hamming(72,64) – every 64-bit word has 8 check bits. Chipkill extends this to survive an entire memory chip failure. In networking, Hamming codes appear in forward error correction for wireless links and storage systems. The Hamming distance concept (minimum bit differences between valid codewords) underpins all coding theory.

Examples

  • ECC RAM: 72-bit bus (64 data + 8 ECC) corrects 1-bit, detects 2-bit errors per word
  • edac-util -s shows correctable/uncorrectable ECC error counts on Linux
  • Hamming distance 3 between codewords = can correct 1 error or detect 2

Related Terms