Error Detection: Parity, Checksum & Cyclic Redundancy Check (CRC)
When raw electrical voltage pulses or radio waves travel across cables and air, electromagnetic interference inevitably corrupts bits in flight.
To prevent silent data corruption, network protocols append redundant error-detecting bits to every frame. Among all techniques, Cyclic Redundancy Check (CRC) is the undisputed champion of the Data Link layer.
โก Why Parity and Checksums Fail
| Technique | Where Used | Detection Strength | Fatal Blind Spot |
|---|---|---|---|
| Simple Parity | Serial UART, RAM | All single-bit errors | Blind to any even number of bit flips (2, 4, 6) |
| Internet Checksum | IPv4, TCP headers | Good general software checksum | Blind to byte swaps and equal opposing errors |
| Cyclic Redundancy Check (CRC) | Ethernet, Wi-Fi, 4G/5G, SATA | Near 100% of all error patterns | Requires hardware shift registers |
๐ง The Mathematics of CRC
CRC treats binary bit strings as algebraic polynomials over the Galois field GF(2), where addition and subtraction are identical to bitwise XOR (oplus) with no carries and no borrows:
beginaligned 1 oplus 1 &= 0 \\ 1 oplus 0 &= 1 \\ 0 oplus 1 &= 1 \\ 0 oplus 0 &= 0 endaligned
The 4-Step CRC Algorithm
- Let the original data be
D(kbits) and the agreed Generator Polynomial beGof degreer(r + 1bits). - Append
rzero bits to the end ofD, yieldingD ยท 2^r. - Divide
D ยท 2^rbyGusing modulo-2 XOR long division. - The remainder
R(rbits) is the Frame Check Sequence (FCS). - The transmitted frame is
T = (D ยท 2^r) oplus R.
At the Receiver:
Received Frame (T)
โโโโโโโโโโโโโโโโโโ = Remainder ?
Generator (G)
โข If Remainder == 0: Frame is intact and accepted!
โข If Remainder != 0: Frame suffered bit corruption -> Discard immediately!
In standard IEEE 802.3 Ethernet, CRC-32 uses a 33-bit generator polynomial that catches 100% of burst errors up to 32 consecutive bits long, keeping our global internet packets bit-for-bit clean!
Solve step-by-step CRC polynomial divisions with our interactive calculator on Binary Dose.
Top comments (0)