How Does CRC in a Frame Determine If Data is Intact?
Errors are common in digital signals because of noise in the transmission line. Due to this, the data sent by the sender will change and may not be the same as it was at the time of sending. Let’s say the sender sent a message to a receiver as “hi”. Converting it into binary form, it is 01101000 01101001. Now let’s say 3 bits were flipped due to some noise, and the data changed to 01101011 01101101. The receiver now retrieves the data as “km” instead of “hi”, changing the whole context.
So how would the receiver know there is some error in the data he received? Here is where error control comes into action.
It is the process of detecting and correcting errors in data frames, due to noise in the transmission line, causing the data to be corrupted or lost.
Error Control can be divided into Error Detection and Error Correction. Various Error Detection techniques are Parity Checking, Cyclic Redundancy Check (CRC), Longitudinal Redundancy Check (LRC), and CheckSum. Error Correction can be done in two ways, Forward Error Correction and Backward Error Correction, including Hamming Codes, Binary Convolution Codes, Reed – Solomon Code, and Low-Density Parity-Check Code as the principal correction codes.
Cyclic Redundancy Check (CRC)
It is one of the most popular error detection methods used for detecting errors in digital data. The errors can be accidental changes in the bits due to some noise in the transmission channel.
It is capable of detecting single-bit errors, burst errors up to length n (order of the polynomial chosen for CRC), and the odd number of errors provided that the polynomial is divisible by (x+1). The polynomial that is generated is used as a tool for error detection. It is available on both the sender and receiver sides.
Following are the steps followed:
Redundant bits appended to payload:
- The sender wants to send data 10101011. Let’s say the polynomial generated is x4+x2+1. The total bits of data in the frame will be (m+n), where m is the payload length and n is the number of redundant bits appended to the payload. Hence the term “Redundancy” contributes to CRC as the bits appended do not provide any information. The term “Cyclic” is used because it works on a system of cyclical implementations (involving modulo arithmetic). The length of the redundant bits is decided by the order of the polynomial generated.
In our case, it will be 4. A modulo 2 binary division is performed after that in which the divisor consists of precisely 1 bit more than the number of redundant bits. Its value is the coefficients of the variables in the polynomial.
- Modulo 2 binary division is done by the same procedure as a normal division, just the difference is that we perform XOR instead of subtraction.
- The remainder of the binary division then replaces the string of 0’s of length n, earlier appended to the payload. The (payload + redundant bits) are sent to the receiver.
Data transmitted to the receiver:
Checking for potential errors on the receiver side:
- After receiving the data, it operates modulo two binary division. This is why the receiver should also have the polynomial same as the sender beforehand. The remainder of the division can be equal to or not equal to zero. The receiver assumes no error in the case of zero remainders and accepts the data, while with a non-zero remainder, it asks the sender for retransmission as it assumes there is some error.
So in this way, CRC determines if the data is intact as it was sent by the sender or has some error.
CRC is very popular due to the following reasons:
- Detects single bit errors, burst errors, and the odd number of errors.
- Simple to implement in binary hardware.
- Simple mathematical analysis and speedy check.
- Used widely for checking data integrity in analog transmission.
- Overflow of data is possible.
- Little protection from an intentional attack on data.