Cyclic redundancy check codes
What Are Cyclic Redundancy Check Codes?
Cyclic redundancy check codes are a class of error-detecting codes used to detect accidental changes to raw data during transmission or storage. A CRC code works by treating the data block as a binary polynomial and dividing it by a shorter fixed generator polynomial; the remainder of that division is appended to the message as a check value. Upon receipt, the receiver performs the same division, and a non-zero remainder indicates that the data has been corrupted. CRC codes are not error-correcting codes: they detect errors but do not identify which bits changed, so correction requires retransmission of the original data.
The mathematical foundation of CRC codes lies in polynomial arithmetic over the Galois field GF(2), where addition and subtraction are both implemented as the bitwise XOR operation. This algebraic structure makes CRC computations highly efficient in both hardware shift registers and software table-driven implementations. The codes were first described by W. Wesley Peterson in 1961 and have since been standardized for use across dozens of communications and storage protocols.
Polynomial Arithmetic and Code Structure
A CRC is defined by its generator polynomial, a binary polynomial of degree r that determines the length of the check value (r bits) and the error-detection properties of the code. Common CRC widths include CRC-8, CRC-16, CRC-32, and CRC-64, where the number refers to the degree of the polynomial and thus the length of the appended remainder. The choice of generator polynomial is not arbitrary: well-chosen polynomials guarantee detection of all single-bit errors, all burst errors of length r or shorter, and a large fraction of longer burst errors. A comparative analysis of CRC standard error-detection properties published in IEEE Transactions examines how different polynomials perform across these error categories.
Error Detection Capabilities
Every CRC standard can detect any single-bit error, any burst of errors whose length does not exceed the degree r of the generator polynomial, and any burst of length r+1 with probability 1 minus 2 to the negative r. This predictable probabilistic behavior is one reason CRC codes are preferred over simpler parity checks for communication channels where burst errors are common. A burst error is a contiguous sequence of corrupted bits, a pattern typical of noise in storage media and transmission lines. The analysis of 32-bit CRC codes for Internet applications demonstrates that CRC-32 provides adequate protection for frame lengths used in Ethernet and similar protocols.
Hardware and Software Implementation
CRC computation maps naturally onto a linear feedback shift register (LFSR), a hardware circuit that performs the polynomial division one bit at a time using a sequence of XOR gates and shift operations. This architecture was the primary implementation method from the 1960s through the 1990s. Modern software implementations use precomputed lookup tables to process one byte or multiple bytes per step, dramatically reducing cycle counts on general-purpose processors. Parallel hardware variants process entire words simultaneously, enabling line-rate CRC computation in network interface chips and storage controllers. Research has continued to explore higher-rate implementations, as studied in CRC-based high-rate error-detection codes for perpendicular recording published in IEEE Transactions on Magnetics.
Applications
Cyclic redundancy check codes have applications in a wide range of communications and storage systems, including:
- Ethernet frame integrity checking using CRC-32 in IEEE 802.3
- USB, Bluetooth, and serial communications protocols
- Hard disk and solid-state drive sector error detection
- Compressed file formats including ZIP and gzip
- Digital broadcast standards such as DVB and ATSC