Cyclic Redundancy Check (CRC)
1. Fundamentals of Cyclic Codes & CRC
Cyclic Redundancy Check (CRC) is a powerful, mathematically rigorous error-detecting code based on binary polynomial division. It is the dominant error-detection algorithm used in modern networking standards, including IEEE 802.3 Ethernet, Wi-Fi, HDLC, and ATM.
Why "Cyclic"?
In cyclic codes, if a codeword is cyclically shifted (rotated), the resulting binary string is also a valid codeword in the codebook.
2. Polynomial Representation of Bit Streams
In CRC, binary bit sequences are represented as polynomials in indeterminate with binary coefficients ( or ):
- Highest power of present in the polynomial defines the Degree of the Polynomial ().
- A polynomial of degree contains binary coefficients.
3. Mathematical Mechanism of CRC
SENDER:
Dataword D (k bits) ──> Append r Zeros ──> Divide by Generator G (r+1 bits)
|
Modulo-2 Remainder R (r bits = CRC)
|
Transmitted Frame = [ Dataword D (k bits) ] + [ CRC Remainder R (r bits) ]
RECEIVER:
Received Frame ──> Modulo-2 Division by Generator G ──> Remainder = 0?
|
Yes: ACCEPT No: REJECT / DISCARD
The Modulo-2 Division Rules:
- Addition and Subtraction in Modulo-2 are identical and equivalent to the XOR operation ().
- There are no carries in addition and no borrows in subtraction.
- If the leftmost bit of the current dividend is
1, the divisor aligns and XORs. - If the leftmost bit is
0, the divisor does not divide (or XORs with all0s).
4. Complete Step-by-Step Solved Numerical
Problem Statement:
A sender wants to transmit the dataword .
The Generator Polynomial is .
- Find the transmitted CRC codeword.
- Verify that the receiver detects no error if the frame arrives uncorrupted.
Step 1: Determine the Divisor and Appended Zeros
- Generator Polynomial: (4 bits).
- Degree of : .
- Append zeros to the dataword:
Step 2: Modulo-2 Division at Sender
1 1 1 0 1 1 <--- Quotient (Ignored)
Divisor: +-------------
1 1 0 1 | 1 0 0 1 0 0 0 0 0 <--- Data + 3 Zeros
^ 1 1 0 1
-----------
0 1 0 0 0
^ 1 1 0 1
---------
0 1 0 1 0
^ 1 1 0 1
---------
0 1 1 1 0
^ 0 0 0 0
---------
1 1 1 0
1 1 0 1
-------
0 0 1 1 0
^ 1 1 0 1
-----------
0 0 1 <--- Remainder R (3 bits) = CRC
Step 3: Construct the Transmitted Codeword
Replace the 3 appended zeros with the 3-bit remainder:
Step 4: Verification at Receiver
The receiver divides the received codeword by the generator :
1 1 1 0 1 1
Divisor: +-------------
1 1 0 1 | 1 0 0 1 0 0 0 0 1
1 1 0 1
-------
1 0 0 0
1 1 0 1
-------
1 0 1 0
1 1 0 1
-------
1 1 1 0
0 0 0 0
-------
1 1 1 0
1 1 0 1
-------
0 1 1 1
1 1 0 1
-------
0 0 0 <--- Remainder = 0 ===> ACCEPT!
Since the remainder is , the frame is accepted as uncorrupted.
5. Standard Generator Polynomials in Networking
| Name | Polynomial Expression | Degree () | Primary Industry Standard |
|---|---|---|---|
| CRC-8 | 8 | ATM Header Error Control (HEC) | |
| CRC-16 (ANSI) | 16 | USB, Modbus, ANSI | |
| CRC-CCITT | 16 | HDLC, X.25, Bluetooth | |
| CRC-32 | 32 | IEEE 802.3 Ethernet, Wi-Fi, ZIP, PNG |
6. Error-Catching Capabilities of CRC
A well-designed generator polynomial guarantees:
- Single-bit errors: Detected if has at least two non-zero terms (contains ).
- Double-bit errors: Detected if does not divide for any .
- Odd number of errors: Detected if contains as a mathematical factor.
- Burst errors of length : detected (where is the polynomial degree).
- Burst errors of length : Detected with probability ( for CRC-32).
7. Key Exam Questions & Takeaways
- How many redundant bits are appended to a dataword if the generator polynomial is ?
- The degree of is , so exactly 4 zeros are appended.
- Why does modulo-2 division use XOR instead of ordinary subtraction?
- In modulo-2 arithmetic over Galois Field , addition and subtraction are identical and carryless, precisely mapping to the electronic logic of the XOR gate.
- What error types are guaranteed to be detected by CRC-32?
- All single-bit errors, all double-bit errors, all odd numbers of inverted bits, and all burst errors up to 32 bits in length.