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.
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.
Checksum
A checksum is a value computed from packet data used to detect transmission errors. TCP, UDP, and IP headers include checksums. The receiver recomputes the checksum on arrival – if it does not match, the packet is silently discarded. Checksums detect accidental corruption but not malicious tampering (use HMAC for that).
Parity Bit
A parity bit is the simplest error detection code – a single bit added to make the total number of 1-bits even (even parity) or odd (odd parity). Parity detects all single-bit errors but cannot detect even numbers of flipped bits. Used in serial communication (RS-232) and RAM (ECC memory uses extended Hamming codes).
Forward Error Correction (FEC)
FEC adds redundant data to transmissions so the receiver can reconstruct lost or corrupted packets without retransmission. Used in satellite links, QUIC, video streaming, and 5G radio. FEC trades bandwidth for reliability – sending 10% extra data can recover from 10% packet loss without any round trips.