You are on page 1of 6

ERROR DETECTION CODES

Amandeep Singh
Dept. Of Electronics and Communication
Lovely Professional University,Phagwara
Punjab, India
khera.amandeepsingh@gmail.com
Abstract In Information Theory and coding theory with
applicaations in computer science and telecommunication, error
detection and coreection are techniques that enable reliable digita
data delivery over unreliable link as communication channel are
prone to noise and thus error may be introduced. Error Detection
Technques allow detecting such errors,while error correction
enable reconstruction of original data.
Index Terms CRC, WSCComponent, formatting, style,
styling, insert. (key words)

I.

INTRODUCTION

The general idea for achieving error detection and correction


is to add some redundancy (i.e., some extra data) to a
message, which receivers can use to check consistency of the
delivered message, and to recover data determined to be
corrupted. Error-detection and correction schemes can be
either systematic or non-systematic: In a systematic scheme,
the transmitter sends the original data, and attaches a fixed
number of check bits (or parity data), which are derived from
the data bits by some deterministic algorithm. If only error
detection is required, a receiver can simply apply the same
algorithm to the received data bits and compare its output with
the received check bits; if the values do not match, an error
has occurred at some point during the transmission. In a
system that uses a non-systematic code, the original message
is transformed into an encoded message that has at least as
many bits as the original message.
Good error control performance requires the scheme to be
selected based on the characteristics of the communication
channel. Common channel models include memory-less
models where errors occur randomly and with a certain
probability, and dynamic models where errors occur primarily
in bursts. Consequently, error-detecting and correcting codes
can be generally distinguished between random-errordetecting/correcting and burst-error-detecting/correcting.
Some codes can also be suitable for a mixture of random
errors and burst errors.
If the channel capacity cannot be determined, or is highly
variable, an error-detection scheme may be combined with a
system for retransmissions of erroneous data. This is known
as automatic repeat request (ARQ), and is most notably used
in the Internet. An alternate approach for error control
is hybrid automatic repeat request (HARQ), which is a
combination of ARQ and error-correction coding.

II.

TYPES OF ERROR

Whenever bits flow from one point to another, they are subject
to unpredictable changes because of interference.This
interference can change the shape of the signal.
In a single-bit error, a 0 is changed to a 1 or a 1 to a 0. The
term single-bit error means that only 1 bit of a given data unit
(such as a byte, character, or packet) is changed from 1 to 0 or
from 0 to 1.
The term burst error means that 2 or more bits in the data unit
have changed from 1 to 0 or from 0 to 1.
III.

FACTORS THAT LEAD TO AN ERROR

The most common causes of data transmission errors between


two devices varies according to connection type (ethernet,
wireless, fiberoptic cable, microwave, laserlink, and so on).
Common causes would be electrical interference, cosmic
radiation, power surges on either end, or wear and tear on the
cable (often in combination with humidity and/or pulling or
pushing on the cable - and obviously this is only applicable for
cable).Error may also be due to multipath propagation of
signal as in case of wireless channel and due interference due
to devices operating in the working range of waves.
IV.

A GENERAL ALGORITHM FOR


ERROR-DETECTION CODES

In this section, we define a binary code so that each of its


codewords consists of n tuples
Q0;Q1; . . .;Qn-1, each tuple is s bits.
This code is not necessarily systematic and is formulated
abstractly to facilitate the development of its mathematical
properties. For practical use, we then construct systematic
versions of the code. Fast software versions of the code will be
presented later in Section 4. It is important to note that Q i is an
uppercase letter, so, by our conventions, Q i is a polynomial of
the variable X, i.e., Qi= Qi (X). Further, being an s-tuple, Q i is
also a polynomial of degree less than s. The polynomial
notation facilitates the mathematical developments of codes.
The tuple notation is more appropriate for software
implementation of codes because an s-tuple is a group of s
bits, which can be easily processed by computers. Note also
that the ns-tuple (Q0;Q1; . . .;Qn-2;Qn-1) is equivalent to the
polynomial

n-1

Qi X(n-1-ii)s of degree less than ns.


i-0
First, let C1 be a binary code with length s and minimum
distance d1. Let r and n be integers such that 1< n < 2r. Let
W0;W1; . . .;Wn-1 be distinct polynomials of degree less than r.
Let M be a polynomial of degree r such that M and X are
relatively prime, i.e., gcd(M,X)= 1. Also, Qi is an s-tuple, i >0.
Now, we are ready to introduce a new code that is simply
called the code C and is the focus of this paper.
Algorithm 1. Let C be the binary code such that each of its
Codewords

respective minimum distances can be very different. For


example,
consider the binary repetition code
{0k; 1k} of length k > 1.
When viewed as the binary code over GF(2), this code has
minimum distance d= k. But, when viewed in GF(2 k), this
same code has minimum distance d = 1.
Let d1 and dC be the minimum distances of the binary codes C 1
and C, respectively, in Algorithm 1. We then have
the following theorem that is proven
Theorem 1.
1. dC > 3 if d1 >3.
2. dc = 4 if d1 > 4.
a.

(Q0,Q1; . . .;Qn-2;Q)
satisfies the following two conditions:
n-1

( QiWi ) mod M = 0
I=0

Systematic Encoding

In general, the binary code C in Algorithm 1 is not systematic.

Now, we construct its systematic versions. Recall that r is the


degree of the modulating polynomial M and s is the number of
bits contained in each tuple Q i. Let r <s and suppose that
information tuples

n-1

Qi C1
I=0

Remark 1.
1. C is nonlinear if C1 is nonlinear.
2. The codewords of C have even weights
if the codewords of C1 have even weights.
3. The code C1 in Algorithm 1 can be nonsystematic.
However, we focus only on systematic codes, which are more
often used in practice. Thus, we assume that C 1 is an (s, s m,
d1) systematic code with m check bits, 0 < m < s. Let F be the
encoder of C1. Then, each codeword of C 1 is UXm + F(U) =
(U, F(U)) , where U is an information(s- m)-tuple and F(U) is
the corresponding check m-tuple.
4. In Algorithm 1, the weights W0,W1, . . .,Wn-1 can be chosen
to be distinct polynomials of degree less than r because 1<n
<2r. However, Algorithm 1 can be extended to allow n > 2r,
then W0;W1; . . .;Wn-1 will not always be distinct.
5. All the codes considered in this paper are binary codes, i.e.,
their codewords consist of digits 0 or 1. In particular, the code
C is a binary code whose codewords are ns bits. Computers
can efficiently process groups of bits. Thus each ns-bit
codeword is grouped into n tuples, s bits each. Note that this
binary code C can also be viewed as a code in GF(2 s), i.e., as a
code whose codewords consist of n symbols, each symbol
belongs to GF(2s). More generally, suppose that ns= xy for
some positive integers x and y, then this same binary code C
can also be viewed as a code whose codewords consist of x
symbols, each symbol belongs to GF(2y). In the extreme case
(x = 1, y = ns), the code C is also a code whose codewords
consist of only one symbol that belongs to GF(2 ns). Note that,
when the same code is viewed in different alphabets, their

(Q0,Q1, . . .;Qn-3 ,U1; U2)


are given, where U1 is an (s -r)-tuple and U2 is an (s m)-tuple.
We wish to append a check r-tuple P 1 and a check m-tuple P2
to (4) so that the resulting codeword is
(Q0;Q1; . . .;Qn-3; U1; U2; P1; P2)
Thus, the code C is ns bits long and has h = r + m check bits.
Denote dC as its minimum distance, then C is an (ns, ns r- m.
dC ) code. Then, we have the following algorithm that is
proven
Algorithm 1a. When r< s, the two check tuples of a systematic
version of the binary code C can be computed by
n-3

P1 = ( QiWi + U1XT)mod M
i=0
P2= Y2 + F(Y1)
where Wi 0, 1 and F is the encoder of C1. The tuples Y1 and
Y2 are determined as follows: Let
n-3

Y = Qi +U1 XT+P1+U2Xm
i=0
which is an s-tuple that can be written as
Y =Y1Xm + Y2 = (Y1, Y2), where Y1 and Y2 are an (s-m)tuple and an m-tuple, respectively.
Remark 2.
After P1 is computed, P2 is easily computed when C1 is one of
the following four types of codes: The first two types of codes,

given in 1 and 2 below, are very trivial, but they are used later
in Section 3 to construct all the codes in Fig. 1. The next two
types of codes, given in 3 and 4 below, are commonly used in
practice for error control.
1. If m=s, then C1={0s}, which is an (s,0, d1) code, where the
minimum distance d1 is undefined. This very trivial code is
called a useless code because it carries no useful information.
However, it can detect any number of errors, i.e., we can
assign d1= for this particular code.
Further, it can be shown that Theorem 1.2 remains valid when
m = s, i.e., dc = 4 if
C1= ( 0s). Then, from Algorithm 1a, we have
U2= 0, F = 0s, Y1=0, and
n-3
P2 =Y2 = Y = Qi + U1Xr + P1.
i=0
2. If m = 0, then C1 = {0, 1}s, which is an (s,s,1)
code. This very trivial code is called a powerless
code because it protects no information.
From Algorithm 1a, we have Y2 = 0, F = 0,
n-3

Y1 =Y = Qi + U1XT+P1 + U2 and P2=0.


i=0
3. If C1 is a systematic linear code with parity check
matrix H = [AI], where A is an m *(s m) matrix and I is the
m * m identity matrix, then F(U)= UA tr, where tr denotes
matrix transpose.
Thus, P2 =Y2 + F(Y1) = Y2+ Y1Atr = YHtr
1.
4. If C1 is a CRC generated by a polynomial M 1 of degree m,
then F(U) =( U Xm) modM1
Thus,
P2=Y2 + (Y1Xm) modM1 =(Y1Xm + Y2) modM1=Y modM1
Algorithm 1a is for the case r <s, where the check r-tuple P1
can be stored in a single s-tuple. Now, we consider the case r >
s. Then, several s-tuples are needed to store the check r-tuple
P1. Because r > s, we can write r = as + b, where a> 1 and 0 <
b < s.).
Algorithm 1b. When r >s, the two check tuples of a systematic
version of the binary code C can be computed by
n-a-3

P1 = Qi + U1 Xb + P10 + P1i + U2Xm


i=0

where P10 is a b-tuple and P11; . . . ; P1a are s-tuples that


satisfy P1 ={P10; P11; . . . ; P1a). Then, Y is an s-tuple that can
be written as Y= Y1Xm + Y2 = (Y1, Y2), where Y1 and Y2 are
an (s -m)-tuple and an m-tuple, respectively.

V.

ERROR DETECTING CODES

a. Parity Check
A parity bit, or check bit, (rewording necessary) is a bit added
to the end of a string of binary code that indicates whether the
number of bits in the string with the value one is even or odd.
Parity bits are used as the simplest form of error detecting
code.
There are two variants of parity bits: even parity bit and odd
parity bit.
In the case of even parity, the number of bits whose value is 1
in a given set are counted. If that total is odd, the parity bit
value is set to 1, making the total count of 1's in the set an
even number. If the count of ones in a given set of bits is
already even, the parity bit's value remains 0.
In the case of odd parity, the situation is reversed. Instead, if
the sum of bits with a value of 1 is odd, the parity bit's value is
set to zero. And if the sum of bits with a value of 1 is even, the
parity bit value is set to 1, making the total count of 1's in the
set an odd number.
Even parity is a special case of a cyclic redundancy
check (CRC), where the 1-bit CRC is generated by
the polynomial x+1.If the parity bit is present but not used, it
may be referred to as mark parity (when the parity bit is
always 1) or space parity (the bit is always 0).
If an odd number of bits (including the parity bit)
are transmitted incorrectly, the parity bit will be incorrect, thus
indicating that a parity error occurred in the transmission. The
parity bit is only suitable for detecting errors; it
cannot correct any errors, as there is no way to determine
which particular bit is corrupted. The data must be discarded
entirely, and re-transmitted from scratch. On a noisy
transmission medium, successful transmission can therefore
take a long time, or even never occur. However, parity has the
advantage that it uses only a single bit and requires only a
number of XOR gates to generate.
b. Cyclic Redundancy Check(CRC)
A cyclic redundancy check (CRC) is an error-detecting
code commonly used in digital networks and storage devices
to detect accidental changes to raw data. Blocks of data
entering these systems get a short check value attached, based
on the remainder of a polynomial division of their contents; on
retrieval the calculation is repeated, and corrective action can
be taken against presumed data corruption if the check values
do not match.
CRCs are so called because the check (data verification) value
is a redundancy (it expands the message without
adding information)
and
the algorithm is
based
on cyclic codes. CRCs are popular because they are simple to
implement
in
binary hardware,
easy
to
analyze
mathematically, and particularly good at detecting common
errors caused by noise in transmission channels.
CRCs are specifically designed to protect against common
types of errors on communication channels, where they can
provide quick and reasonable assurance of the integrity of

messages delivered. However, they are not suitable for


protecting against intentional alteration of data.
Firstly, as there is no authentication, an attacker can edit a
message and recompute the CRC without the substitution
being detected. When stored alongside the data, CRCs and
cryptographic hash functions by themselves do not protect
against intentional modification of data. Any application that
requires protection against such attacks must use
cryptographic authentication mechanisms, such as message
authentication
codes or digital
signatures (which
are
commonly based on cryptographic hash functions).
Secondly, unlike cryptographic hash functions, CRC is an
easily reversible function, which makes it unsuitable for use in
digital signatures.
Thirdly, CRC is a linear function with a property
that
; as a result, even if the CRC is encrypted with
a 2a stream cipher, such as OFB or CFB), both the message
and the associated CRC can be manipulated without
knowledge of the encryption key; this was one of the wellknown design flaws of the Wired Equivalent Privacy (WEP)
protocol.

check r-tuple and check m-tuple by


P,*=P1 + E(Y1) and P2*=P2 + even parity of E(Y1).
Then, it can be shown that, if C1 is an extended perfect code
and n 2r, then the resulting code C whose check tuples are
P1*0 and P2* is an extended perfect code. Further, when r = 1,
this extended perfect code becomes the extended perfect code
that is obtained from the systematic a perfect code

d. CXOR Checksum
Suppose now that we allow some of the polynomials
W0;W1; . . .;Wn_1 to be repeated and we use Algorithm along
with variation (9). Let r = s = m, M =Xs +1, and Wi = Xi
modM. It can be shown that
Wi+s =Wi for all i >1, i.e.,
some of the weighting polynomials may repeat. Then, C1 =(0s}
(because m = s), U1 =0 (because r = s), and U2 = Y1 = 0
(because m = s).

We have P1 = Qi.
i=0

Consider an h-bit CRC that is q bits long and is generated by a


polynomial M. Suppose that q and h can be written as q = x+
(n-1)s and h=as+b, where n>=1 , 0<=x<=s, a>=0, and 0<b<=s,
Then, it can be shown that the CRC check tuple is
n-a-2
P =( Qi Wi + U1XT ) mod M,
i=0
where Wi = X(n-1-i)s modM, i= 0, 1, . . . ; n -a -2. Further,
we show that the weighting polynomials Wi are distinct and
Wi 0,1Xs ; . . .;Xas, provided that q < 2h-1-1 and M is the
product of (X + 1)and a primitive polynomial of degree h - 1.

e.

Nonbinary Perfect Code

Suppose that Algorithm 1a along with variation (9) is applied


with r = s = m and n =2m+ 1. Let M be a primitive polynomial
of degree m and let
W0;W1; . . .;Wn-3
be distinct and nonzero polynomials. Then, C1 ={0s},
2m-2

Now, consider the code C that has the same length and
the same weighting polynomials as the above CRC. Let r =h
and m = 0. Then, P2= 0 and P1= P Thus, this particular code
C is identical to the above CRC.

P1= QiWi modM

and

I=0
2m-2

P2= Qi
i=0

c. Binary Extended Perfect Code


We now show that Algorithm produces an extended perfect
code if the code C1 is an extended perfect code.
Suppose that C1 is a (2m-1, 2m-1 m, 4) extended perfect
code i.e., s = 2m-1 and d1= 4. Let n = 2r and h=r+m then the
code C has ns = 2^(r+m-1)=2^(h-1) bits. Then, d C= 4 and C is
a (2h-1 ; 2h-1 h,4) extended perfect code. Note that deleting a
check bit froman extended perfect code will yield a perfect
code, while adding an overall even parity bit to a perfect code
will yield an extended perfect code.
Algorithms and can be further generalized to include the
extended perfect code as follows:
P1, P2, and Y1 are the check r-tuple, check m-tuple, and
(s m)- tuple, respectively, which are computed from
Algorithms. Let E(.) be any function from the set of (s m)
tuples to the set of r-tuples. Now, define the new

It then canbe shown that P1 and P2 are two check tuples of


the nonbinary .
f.

Ones Complement Checksum


and Fletcher Checksum

The above codes are constructed using polynomial arithmetic


because each tuple is considered as a polynomial overthe
binary field f0; 1g. An alternative is to consider each tuple as
an integer and to use the rules of (onescomplement) integer
arithmetic to manipulate the code construction. If we apply the
integer arithmetic to the construction of the block-parity code
and to the nonbinary perfect code, we will get the onescomplement checksum and Fletcher checksum, respectively.
However, these integer-based codes are often weaker than

their binary polynomial counterparts (see Fig. 1). See [4], [5],
[9] for definitions and performance comparisons of errordetection codes, including the ones-complement and Fletcher
checksums.
Thus, the integer-arithmetic version also produces the onescomplement and Fletcher checksums. We will not discuss
thesechecksums and integer-based codes any further because
they are often weaker than their polynomial counterparts and
their analyses can be found elsewhere
VI.

SUMMARY AND CONCLUSION

The code with the best error detection properties has largest
values of d, b and k for a given h. Assuming the most probable
errors are those that change fewest bits, the most important
parameter is d. The second most important parameter is b
because a larger b guarantees detecting a larger single burst of
errors. The parameter k is least important because k need only
be large enough to cover the largest block size ( a larger k gives
no additional benefit).Fig 1 shows five codes listed above in
order of their error detection capabilities. CRC has the best
error detection properties. Weighted Sum Codes are almost as
good with just a more limited error detection block size though
the other three codes have inferior error detection properties.
The CXOR and Internet Checksum are very weak because they
detect only single bit errors. While the Fletcher checksum can
detect all two bit errors, it can guarantee only half the burst
error detection of the other codes.

Fig 1. Errror Detection Capabilities of binary code (d= minimum distance.


b= burst error detection capability, h=nimber of check bits, ;max= maximum
codeword length)

VII.

REFRENCES

D. Bertsekas and R. Gallager, Data Networks, second ed. Englewood


Cliffs, N.J.: Prentice Hall, 1992.
[2] A. Binstock and J. Rex, Practical Algorithms for Programmers.
Reading, Mass.: Addison-Wesley, 1995.
[3] P. Farkas, Comments on Weighted Sum Codes for Error
Detection and Their Comparison with Existing Codes, IEEE/
ACM Trans. Networking, vol. 3, no. 2, pp. 222-223, Apr. 1995.
[4] D.C. Feldmeier, Fast Software Implementation of Error
Detection Codes, IEEE/ACM Trans. Networking, vol. 3, no. 6, pp.
640-651, Dec. 1995.
[5] J.G. Fletcher, An Arithmetic Checksum for Serial
Transmissions,IEEE Trans. Comm., vol. 30, pp. 247-252, Jan. 1982.
[6] J.G. Fletcher, ACM Computing Rev., vol. 36, no. 1, p. 66, Jan.
1995.
[7] T. Klove and V. Korzhik, Error Detecting Codes: General Theory
and Their Application in Feedback Communication Systems. Kluwer
Academic, 1995.
[8] F.J. MacWilliams and N.J. A. Sloan, The Theory of ErrorCorrecting
Codes. New York: North-Holland, 1977.
[9] A.J. McAuley, Weighted Sum Codes for Error Detection and
Their Comparison with Existing Codes, IEEE/ ACM Trans.
Networking, vol. 2, no. 1, pp. 16-22, Feb. 1994.
[10] G.D. Nguyen, A General Class of Error-Detection Codes,
Proc.
32nd Conf. Information Sciences and Systems, pp. 451-453, Mar.
1998.
[11] A. Perez, Byte-Wise CRC Calculations, IEEE Micro, vol. 3,
pp. 4050, June 1983.
[12] T.V. Ramabadran and S.S. Gaitonde, A Tutorial on CRC
Computations, IEEE Micro, vol. 8, pp. 62-75, Aug. 1988.
[13] D.V. Sarwate, Computation of Cyclic Redundancy Checks via
Table-Lookup, Comm. ACM, vol. 31, no. 8, pp. 1008-1013, Aug.
1988.

You might also like