International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 4, April 2014)
Cyclic Redundancy Codes: Study and Implementation
Sukirty Jain1, Siddharth Singh Chouhan2
1
Student, 2Asst.Prof., Department of Information Technology, LNCT, Bhopal, M.P., India
Abstract- This paper introduces a way to authenticate the Transmitted data---1 1 1 0 1 1 0 1
data transmitted over the network using Cyclic Redundancy (1 is changed to 0)
Check (CRC) error detection technique which work on the Received data------1 0 1 0 1 1 0 1
concept of binary division. A network must be capable of
transmitting the data from one end to other end with B. Burst error
accuracy. But transmission errors are the common fact of When multiple bits of data unit get corrupted during
data communication. It is not mandatory that data received
the transmission known as burst error. It is also known as
at receiver end is identical to the data transmitted by the
sender. There are a number of reasons responsible for data the multiple bit error .Its detection and correction is
corruption as thermal noise, impulse noise, etc. For reliable difficult. They occur in serial data transmission where all
communication, it is required that the system must be the n bits are transmitted using a single transmission
enriched with error detection and error correction media e.g.:
techniques. Therefore a number of error control techniques In this, multiple bit are changed-
have been introduced and one of them is CRC to achieve Transmitted data---1 1 1 0 1 1 0 1
accuracy in data communication.
Received data------ 1 0 1 0 0 1 1 1
Index Terms- CRC (Cyclic Redundancy check), Data link C. Data
layer, Generating Function, LRC (Longitudinal
Redundancy Check), VRC (Vertical redundancy check). The information to be transmitted in the form of bits is
known as data.
I. INTRODUCTION D. Message
Channel coding is an important operation for signal The combination of data bits and the CRC bits
processing for the efficient transmission of digital generated using CRC generator algorithm is known as the
information (data in the form of bits) over the channel. In message. It is also referred as the data unit.
channel coding the number of symbols in the source The basic concept used in CRC technique is that when
encoded message is increased in a controlled manner in the message is operated under binary division using
order to facilitate two basic objectives at the receiver one generating polynomial as the divisor then the remainder
is Error detection and other is Error correction. Error must be zero to proof the correctness of data.
detection and error correction to achieve good
communication is also employed in devices. It is used to [Message][CRC bits]
reduce the level of noise and interferences in electronic -------------------------- = 0
medium.Whenever the data is transmitted over the Generating function
network, it does not guarantee for its accurate reception
and suffer from unpredictable changes in the transmission II. ERROR CONTROL
media. Therefore the Data Link layer in OSI model is Error control is the process of error detection and error
responsible for error control. Error control is defined as correction when the data is transmitted over the network
the combination error correction and error detection. from one end to other end. It assures that the data is
When the data is transmitted over the network, it is the accurately transmitted to other end. This is required to
responsibility of Data Link layer to check for the error protect the data from any type of alteration, enhancement
between the routers and to correct them.Error is any or any other type of changes. This allows one to identify
unwanted change which reduces the usefulness of whether data unit received is altered in midway or it is
original data. received in its original form as transmitted from the
There are two types of error- sender end. The most common type of attack in data
1. Single bit error communication is man-in-the-middle whose presence
2. Burst error results in data transformation. Error control is
A. Single bit error implemented at the transport layer and data link layer of
OSI model but transport layer provides error control
When only one bit of data unit gets corrupted during between router and host and data link layer provides error
the transmission known as single bit error.Its detection control between router and router. This study is
and correction is easy. They occur in parallel data concerned with the error control at data link layer.
transmission where n different cables are used to transmit
n different data bits e.g.:
213
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 4, April 2014)
A. Error detection A.CRC generator
The process of detecting the error using the concept of It is the process of calculating the CRC bits at sender
redundancy is known as error detection. Redundancy side using a generating function such that the data unit
means some extra bits are append to the data unit for and generating function are operated using bit-wise XOR
error detection and the extra bits appended are known as operation where generating function is of n+1 bits and
the redundant bits. There are four different techniques CRC is of n bits. The data bits to be operated are
used for error detection- appended with the n 0’s which together referred as data
1. Vertical redundancy check (VRC) unit to be transmitted to receiver end.
2. Longitudinal redundancy check (LRC) B. CRC checker
3. Cyclic redundancy check (CRC)
It is the process of calculating the CRC bits at receiver
4. Checksum.
side to check whether they are equivalent to 0 or not. It
B. Error correction also uses the same bit-wise XOR operation on data unit
The process of correcting the error after detecting error received from sender side and generating function. If all
before its reception is known as the error correction. The the CRC bits are 0 then data unit is accepted otherwise it
Hammingcode technique is generally used for error is discarded.
correction in Data link layer. This paper makes an C. Polynomial
assessment on CRC error detection technique.
The polynomial must satisfy following conditions-
C. Redundancy 1. It should not be divisible by x.
One way for error detection is to retransmit the data 2. It should be divisible by x+1.
bits to receiver end. The receiver will make a bit by bit The first condition guarantees that it can detect the
comparison to detect the error. It is an accurate technique burst error of length equal to highest degree of
but not efficient one as it increases the time requirement. polynomial.
Rather than retransmitting the data bits, a group of bits is The second condition guarantees that all burst error
appended to the data unit for error detection. This concept affecting odd number of bits are detected. The Generating
is known as the redundancy and the extra bits appended polynomial is an important part of CRC error detection
are known as the redundant bits. These bits are discarded technique.
if the accurate data unit is received by the receiver. It is simply a mathematical equation which is used to
find the generating function bits. This generating function
i. Generating function:
can be obtained by finding the coefficient of each and
It is the mechanism used for generating the redundant every term of the equation. The total numbers of bits in
bits by analyzing the data. The generating function at the generating function are one more than the highest
receiver and sender side is same. degree of equation.
ii. Use: For ex.:
To check the accuracy of data transmitted. If the highest degree of any given equation is 4 then
This helps in deciding whether to accept or reject the the number of generating function bits are 5.
data. This generating function always remains same at both
sender and receiver side then only it computes the
III. CRC (C YCLIC REDUNDANCY CHECK) accurate result. If this function is changed due to any
reason then it will generate false result and error
It is one of the most powerful error detection technique
detection is not guaranteed for the given data unit. Both
based on the principle of binary division. In this, a
the sender and receiver will have the wrong assumption
sequence of bits append to the data unit is known as the
for data unit and it will be difficult to identify that
CRC which has two important qualities-
whether data unit is correct or corrupted. It may be
1. It must be one less than the number of divisor bits. possible that CRC generated at sender side is correct but
2. After appending these bits data unit must be exactly due to altered generating function at receiver function the
divisible by divisor. correct data may be interpreted wrong and the wrong data
There are two important steps of CRC technique- is interpreted as correct.
1. CRC generator Let the generating polynomial be-
2. CRC checker x^3+x+1
214
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 4, April 2014)
Then the generating function is- 3. Perform Adder operation on the variable entered in
1011 step-1.
1-coefficient of degree 3 4. Store data bits, generating function bits and data unit
0-coefficient of degree 2 (data bits + CRC bits) to be operated in different arrays.
1-coefficient of degree 1 5. Repeat step-6 until each bit of data unit is processed.
1-coefficient of degree 0 6. Check data unit to be operated-
if(1st bit==0)
The highest degree of given polynomial equation is 3,
XOR the data unit with 0 and store
therefore the number of bits in the generating function
the result in same array of data unit.
is 4.
else
Let there is another example for finding the generating
XOR the data unit with generating
polynomial where the last term of equation is not given.
function and store the result in same
Let the given polynomial equation be-
array of data unit.
x^5+x^3+x^2+x 7. Display CRC bits and data unit to be transmitted over
Then the generating function is- the network to receiver end after appending CRC bits to
101110 data bits.
1-coefficient of degree 5 B. Algorithm for CRC checker
0-coefficient of degree 4
1. Input the number of data unit bits (number of data bits
1-coefficient of degree 3
+ number of CRC bits) received from the sender.
1-coefficient of degree 2
2. Enter generating function bits, its value and data unit
1-coefficient of degree 1
bits value.
0-coefficient of degree 0
3. Store generating function bits and data unit (data bits +
The highest degree of given polynomial equation is 5, CRC bits) received from sender in different arrays.
therefore the number of bits in the generating function 4. Repeat step-5 until each bit of data unit is processed.
is 6. 5. Check data unit received from sender-
if(1st bit==0)
IV. ALGORITHM XOR the data unit with 0 and store
There are two algorithm proposed for CRC error the result in same array of data unit.
detection technique in which one is to generate the CRC else
bits at sender side and another is for error detection in XOR the data unit with generating
data unit transmitted from one end to other end at function and store the result in same
receiver side. The CRC bits computed using CRC array of data unit.
generator algorithm is appended to the data unit to be 6. Display CRC bits, perform adder operation on them
transmitted to other end. The received message is and store the result in an integer variable.
checked using CRC checker algorithm and if it is correct 7. Check the value of integer variable (var)-
then the CRC is discarded and data is accepted otherwise if (var ==0)
data is discarded. This paper presents a clear algorithm Data unit is correct and accepted
for CRC. Initially when there is only information then 0s after discarding the CRC bits.
are appended to the data bits which act as CRC bits to else
compute the CRC. The computed result is replaced by 0 Data unit received is corrupted and
bits append to the data bits. This is the actual data unit discarded.
which is also known as the message and transmitted over
the network to the other end. At the receiver side, same Fig4.1 and fig4.2 represents the flowchart for CRC
generating function is used and result is computed. If it is checker and CRC generator.
all 0s then data received is correct otherwise it is In CRC generator, data bits, number of CRC bits,
corrupted and discarded. The two algorithms are as generating function bits and its value is entered from the
below- user. The data bits and CRC bits are operated under
binary addition. The result generated after binary addition
1. Algorithm for CRC generator
is operated under binary division using generating
2. Algorithm for CRC checker
function obtained by generating polynomial. The
A. Algorithm for CRC generator remainder of the binary division is the actual CRC
1. Input the number of data bits and CRC bits. generated at sender side. The CRC is appended to the
2. Enter generating function bits, its value and data bits data bits and transmitted on the network for the
value. destination.
215
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 4, April 2014)
At the destination end, same generating function is If the remainder of binary division is all 0s then the
used and received message is operated under binary data unit is correct and accepted for further processing
division using the same procedure to ensure whether the but if the remainder is non-zero then data has been altered
data unit is correct or corrupted. in the mid way during transmission and it is discarded by
the receiver as it is of no use to the receive end.
Fig 4.1 CRC Generator
Fig 4.2 CRC Checker
V. CONCLUSION AND FUTURE WORK REFERENCES
This paper presented the error detection technique [1] Peterson; et.al, "Cyclic Codes for Error Detection", Proceedings of
CRC based on the binary division using basic XOR bit- the IRE, Vol: 49 (1): ,January 1961.
wise operation and algorithm to implement it. It works on [2] Ritter, Terry, "The Great CRC Mystery", Dr. Dobb's
Journal 11 (2), 21 May 2009.
the concept of redundancy that is to append some extra
[3] Stigge, Martin; et.al, “Reversing CRC – Theory and Practice”,
bits in data unit known as redundant bits to detect the Berlin: Humboldt University Berlin, p. 17, retrieved 4 February
error and implemented at the Data Link layer of OSI 2011.
model. There are a number of techniques used for error [4] Williams, Ross N. (24 September 1996), "A Painless Guide to
detection at data link layer among which CRC provides CRC Error Detection Algorithms V3.00", retrieved 5 June 2010.
desirable efficiency. It provides good performance in [5] WH; Teukolsky, et.al,"Section 22.4 Cyclic Redundancy and Other
terms of accuracy and security compared to other Checksums", Numerical Recipes: The Art of Scientific
Computing (3rd ed.). New York: Cambridge University.
techniques. The future challenge is to make the code
[6] Koopman; et.al, "Cyclic Redundancy Code (CRC) Polynomial
applicable to real world entity for example, audio, image Selection for Embedded Networks", The International Conference
etc. on Dependable Systems and Networks: 145–154, retrieved 14
January 2011.
VI. P ERFORMANCE ANALYSIS O F CRC [7] Castagnoli; et.al , "Optimization of Cyclic Redundancy-Check
Codes with 24 and 32 Parity Bits". IEEE, June 1993.
1. It can detect all burst error affect odd number of bits.
[8] Koopman, Philip, "32-Bit Cyclic Redundancy Codes for Internet
2. It can detect all burst error of length less than or equal Applications". The International Conference on Dependable
to degree of polynomial. Systems and Networks, Retrieved 14 January 2011.
[9] Yanbin Zhang; Qi Yuan,” A multiple bits error correction method
3. It can detect burst error of length greater than degree of based on cyclic redundancy check code”, 9th International
polynomial with high probability. Conference on Signal Processing, ICSP 2008.
216
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 4, April 2014)
[10] Debopam Ghosh; et.al, ” A generalized code for computing cyclic [12] http://en.wikipedia.org/wiki/Cyclic_redundancy_check.
redundancy check”, International Journal of Students Research in [13] Vikas gupta; et.al,”Error detection and correction: An
Technology & Management, Vol 1(2), April 2013. Introduction”,vol:2(2), ISSN, Nov 2012.
[11] Jun Jin Kong ;et.al,” Interleaved cyclic redundancy check (CRC)
code”, Conference Record of the Thirty-Seventh Asilomar
Conference on Signals, Systems and Computers, Vol:2,2004.
217