Error Detection and Correction Using Hamming and Cyclic Codes in a Communication Channel

: This paper provides an overview of two types of linear block codes: Hamming and cyclic codes. We have generated, encoded and decoded these codes as well as schemes and/or algorithms of error-detecting and error-correcting of these codes. We have managed to detect and correct errors in a communication channel using error detection and correction schemes of hamming and cyclic codes.


Introduction
Coding theory is concerned with the transmission of data across noisy channels and the recovery of corrupted messages, Altaian [1]. It has found widespread applications in electrical engineering, digital communication, Mathematics and computer science. While the problems in coding theory often arise from engineering applications, it is fascinating to note the crucial role played by mathematics in the development of the field.
The importance of algebra in coding theory is a commonly acknowledged fact, with many deep mathematical results being used in elegant ways in the advancement of coding theory; therefore coding theory appeals not just to engineers and computer scientists, but also to mathematicians and hence, coding theory is sometimes called algebraic coding theory, Doran [3].
An algebraic techniques involving finite fields, group theory, polynomial algebra as well as linear algebra deal with the design of error-correcting codes for the reliable transmission of information across noisy channels.
Usually, coding is divided into two parts: a Source coding: Source encoding Source decoding b Channel coding: Channel encoding Channel decoding Source encoding involves changing the message source to a suitable code say u to be transmitted through the channel. Channel encoding deals with the source encoded message u , by introducing some extra data bits that will be used in detecting and/or even correcting the transmitted message, Hall [4]. Thus the result of the source encoding is a code word, say v . Likewise, channel decoding and source decoding are applied on the destination side to decode the received code word r as correctly as possible. Figure 1 represents a model of a data transmission system. For example: Consider a message source of four fruit words to be transmitted: apple, banana, cherry and grape. The source encoder encodes these words into the following binary data 1 2 3 4 ( ) u u u u : Apple → 1 u = (0, 0), banana → 2 u = (0, 1), Cherry → 3 u = (1, 0), Grape → 4 u = (1, 1).
Suppose the message 'apple' is to be transmitted over a noisy channel. The bits 1 (0, 0) u = will be transmitted instead. Suppose an error of one bit occurred during the transmission and the code (0, 1) is received instead as seen in the following figure. The receiver may not realize that the message was corrupted and the received message will be decoded into 'banana'. With channel coding, this error may be detected (and even corrected) by introducing a redundancy bit as follows 1 2 3 4 ( ) v v v v : (00) (000), 1 (01) (011), 2 (10) (101), 3 (11) (110). The newly encoded message 'apple' is now (000). Suppose this message was transmitted and an error of one bit only occurred. The receiver may get one of the following: (100), (010) or (001). In this way, we can detect the error, as none of (100), (010) or (001) is among our encoded messages.
Note that the above channel encoding scheme does not allow us to correct errors. For instance, if (100) is received, then we do not know whether (100) comes from (000), (101) or (110). However, if more three redundancy bits are introduced instead of one bit, we will be able to correct errors. For instance, we can design the following channel coding scheme: (00) (00000), (01) (01111), (10) (10110), (11) Again if the message (00000) was transmitted over a noisy channel and that there is only one error introduced, then the received word must be one of the following five: (10000), (01000), (00100), (00010) or (00001). Since only one error occurred and since each of these five codes differs from (00000) by only one bit, and from the other three correct codes (01111), (10110) and (11001) by at least two bits, then the receiver will decode the received message into (00000) and, hence, the received message will be correctly decoded into 'apple'.
Algebraic coding theory is basically divided into two major types of codes: Linear block codes and Convolutional codes, Blahut [2].
In this paper we present some encoding and decoding schemes as well as some used error detection/correction coding techniques using linear block codes only. We discuss only two types of linear block codes: Hamming and cyclic codes.

Problem Statement
In any environment, noise, electromagnetic radiations and any other forms of disturbances affect communication leading to corrupted messages, errors in the received messages or even to an extent of the message not being received at all.

General Objective
The main objective of this study was to provide an overview of two types of linear block codes: Hamming and cyclic codes and study schemes and/or algorithms of error detection and correction of these codes.

Specific Objectives
To generate, encode and decode hamming and cyclic codes. To detect and correct errors using hamming and cyclic codes.

Justification of Study
Transmission of data across noisy channel and other forms of interference affect communication resulting to misdirected messages. Hence, we need the recovery of these corrupted messages. Considering the present concern with privacy and secrecy, and the prospect that such problems will increase significantly as communication services and data repositories grow, importance is thus attached to finding means of detecting and correcting any error that occur. Thus the need for a code that fully guarantees security in the sense that whenever two or more persons send or receive this code then data integrity and authentication are guaranteed. In this paper we present some encoding and decoding schemes as well as error detection/correction coding techniques using linear

Null Hypothesis
Codes for non-binary input channels such as the dualcode [1] useful on multiple frequency shift channels, and on practical implementations of high rate codes cannot work on binary channels.

Literature Review
The history of data-transmission codes began in 1948 with the publication of a famous paper by Claude Shannon. Shannon showed that associated with any communication channel or storage channel is a number C (measured in bits per second), called the capacity of the channel, which has the following significance: Whenever the information transmission rate R (in bits per second) required of a communication or storage system is less than C then, by using a data-transmission code, it is possible to design a communication system for the channel whose probability of output error is as small as desired. Shannon, however, did not tell us how to find suitable codes; his contribution was to prove that they exist and to define their role. Throughout the 1950s, much effort was devoted to finding explicit constructions for classes of codes. The first block codes were introduced in 1950 when Hamming described a class of single-error-correcting block codes and he published what is now known as Hamming code, which remains in use in many applications today.
In 1957, among the first codes used practically were the cyclic codes which were generated using shift registers. It was quickly noticed by Prange that the cyclic codes have a rich algebraic structure, the first indication that algebra would be a valuable tool in code design.
In the 1960s, the major advances came in 1960 when Hocquenghem and Bose and Ray-Chaudhuri found a large class of multiple-error-correcting codes (the BCH codes). The discovery of BCH codes led to a search for practical methods of designing the hardware or software to implement the encoder and decoder. In the same year independently, Reed, Solomon and Arimoto found a related class of codes for non-binary channels. Concatenated codes were introduced by Forney (1966), later Justesen used the idea of a concatenated code to devise a completely constructive class of long block codes with good performance.
During the 1970s, these two avenues of research began to draw together in some ways and to diverge further in others. Meanwhile, Goppa (1970) defined a class of codes that is sure to contain good codes, though without saying how to identify the good ones.
The 1980s saw encoders and decoders appear frequently in newly designed digital communication systems and digital storage systems, Hamming [5].
The 1990s witnesses an evaluation of all groups in informatics at the universities in Norway. The evaluation was performed by a group of internationally recognized experts. The committee observed that the period 1988-92, had the largest number of papers (27) published in internationally refereed journals among all the informatics groups in Norway. In the period 1995-1997 the goal of finding explicit codes which reach the limits predicted by Shannon's original work has been achieved. The constructions require techniques from a surprisingly wide range of pure mathematics: linear algebra, the theory of fields and algebraic geometry all play a vital role, Han [6]. Not only has coding theory helped to solve problems of vital importance in the world outside mathematics, it also has enriched other branches of mathematics, with new problems as well as new solutions, Kolman [7]. In 1998 Alamouti described a space-time code.
In During this decade, development of algorithms for hard-decision decoding of large nonbinary block codes defined on algebraic curves, Kabatiansky [8]. Decoders for the codes known as hermitian codes are now available and these codes may soon appear in commercial products. At the same time, the roots of the subject are growing even deeper into the rich soil of mathematics. Doumen (2003), researched on the aims of cryptography in providing secure transmission of messages in the sense that two or more persons can communicate in a way that guarantees confidentiality, data integrity and authentication.
Sebastia (2003) studied on the Block error correcting codes. He found that the minimum distance decoder maximizes the likelihood of correcting errors if all the transmission symbols have the same probability of being altered by the channel noise. He also noted that if a code has a minimum distance d, then d(C) -1 is the highest integer with the property that the code detects d(C) -1 errors.
Todd [11], studied on the Error control coding. He showed that if a communication channel introduces fewer error than the minimum distance errors, d(C), then these can be detected and if d(C)-1 errors are introduced, then error detection is guaranteed (see also [8]). He also noted that the probability of error detection depends only on the error introduced by the communication channel and that the decoder will make an error if more than half of the received bit strings are in error [9].
In 2009, Nyaga [10] studied the Cyclic ISBN-10 to improve the conventional ISBN-10. They designed a code that would detect and correct multiple errors without many conditions attached for error correction and found out that the code could correct as many errors as the code could detect. The method involves trial and error calculation and thus it needs to be improved on and simplified to speed up the process.
Asma & Ramanjaneyulu [12] studied the implementation of Convolution Encoder and Adaptive Viterbi Decoder for Error Correction. Egwali Annie and Akwukwuma [13] investigated Performance Evaluation of AN-VE: An Error Detection and Correction Code. Vikas Gupta and Chanderkant Verma [14] examined Error Detection and Correction: Viterbi Mechanism. Error Detecting and Error Correcting Codes were examined by Chauhan et al [15].

Methodology
This section sets the methodology of the research by discussing the Linear Block codes.

Basic concepts of Block Codes
The data of output of the source encoder are represented by sequence of binary digits, zeros or ones. In block coding this sequence is segmented into message blocks There are a total of 2 k distinct messages. The channel encoder, according to certain rules, transforms each input message into a word

Basic Properties of a Linear Block Code
The zero word (00…0), is always a codeword. If c is a codeword, then (-c) is also a codeword. A linear code is invariant under translation by a codeword. That is, if c is a codeword in linear code C, then C + c = C. The dimension k of the linear code C(n, k) is the dimension of C as a subspace of n V over GF(2), i.e. dim( ) C k = .

Encoding Scheme
is the message to be encoded, then the corresponding codeword v can be given as follows: v = u. G

Error Detection, Error Correction & Decoding Schemes
A fundamental concept in secure communication of data is the ability to detect and correct the errors caused by the channel. In this chapter, we will introduce the general schemes/methods of linear codes decoding.
Channel Model / Binary Symmetric Channel The channel is the medium over which the information is conveyed.
Examples of channels are telephone lines, internet cables and phone channels, etc. These are channels in which information is conveyed between two distinct places or between two distinct times, for example, by writing information onto a computer disk, then retrieving it at later time.
Now, for purposes of analysis, channels are frequently characterized by mathematical models, which (it is hoped) are sufficiently accurate to be representative of the attributes of the actual channel.
In this paper we restrict our work on a particularly simple and practically important channel model, called the binary symmetric channel (BSC), and defined as follows: Definition 1: A binary symmetric channel (BSC) is a memoryless channel which has channel alphabet {0, 1} and channel probabilities. Figure 3, shows a BSC with crossover probability p.

General Methods of Decoding Linear Codes Over BSC
In a communication channel we assume a code word n r r r − = is received at the output of the channel. If r is a valid codeword, we may conclude that there is no error in v. Otherwise, we know that some errors have occurred and we need to find the correct codeword that was sent by using any of the following general methods of linear codes decoding: Maximum likelihood decoding, Nearest neighbor/Minimum distance decoding Syndrome decoding Standard array Syndrome decoding using truth table These methods for finding the most likely codeword sent are known as decoding methods.

Maximum Likelihood Decoding
Suppose the codewords 0 1 block code C(n, k) and suppose a BSC with crossover Then, the maximum likelihood decoding (MLD) will conclude that r v is the most likely codeword transmitted if r v maximizes the forward channel probabilities.

Nearest Neighbor Decoding/Minimum Distance
Decoding Important parameters of linear block codes called the hamming distance and hamming weight are introduced as well as the minimum distance decoding.

The Minimum Distance Decoding
Suppose the codewords 0 1 from a code C(n, k) are being sent over a BSC. If a word r is received, the nearest neighbor decoding or (minimum distance decoding) will decode r to the codeword r v that is the closest one to the received word r. Such procedures can be realized by an exhaustive search on the set of codewords which consists of comparing the received word with all codewords and choosing of the closest codeword.

Syndrome & Error Detection
Consider an (n, k) linear code C. Let

Syndrome & Error Correction
The syndrome s of a received vector r = v + e depends only on the error pattern e, and not on the transmitted codeword v.

Error-Detecting& Error-Correcting Capabilities of Block Codes Error-Detecting Capabilities of Block Codes
Let m be a positive integer. A code C is u error detecting if, whenever a codeword incurs at least one and at most u errors, the resulting word is not a codeword.
A code is exactly u error detecting if it is m error detecting but not ( 1) m + error detecting.

Error-Correcting Capabilities of Block Codes
If a block code with minimum distance min d is used for random-error correction, one would like to know how many errors that the code is able to correct.
A block code with minimum distance min d guarantees correcting all the error patterns of errors. The parameter t is called the random-error-correcting capability of the code.

Syndrome Decoding
We will discuss a scheme for decoding linear block codes that uses a one-to-one correspondence between a coset leader and a syndrome. So we can form a decoding table, which is much simpler to use than a standard array. The

Construction of Binary Hamming Codes
Hamming codes are the first important class of linear error-correcting codes named after its inventor, Hamming [1] who asserted by proper encoding of information, errors induced by a noisy channel or storage medium can be reduced to any desired level without sacrificing the rate of information transmission or storage. We discuss the binary Hamming codes with their shortened and extended versions that are defined over GF (2). These Hamming codes have been widely used for error control in digital communication and data storage. They have interesting properties that make encoding and decoding operations easier.
In this section we introduce Hamming codes as linear block codes that are capable of correcting any single error over the span of the code block length.
Let , r Z ∈ the hamming code of order r is a code generated when you take a parity check matrix H and (2 1) r r × − matrix with columns that are all the (2 1) r − non-zero bit strings of length r in any order such that the last r columns form an identity matrix.

Remark 1:
Interchanging the order of the columns lead to an equivalent code.
In other words, the syndrome may be interpreted as the vector sum of those columns of the matrix corresponding to the positions of the errors. Now, consider all error words of weight one are to have distinct syndromes, and then it is evidently necessary and sufficient that all columns of the matrix must be distinct.
For if ( ) 1 w e = say 1 In other words, the parity-check matrix H of this code consists of all the nonzero (    It follows from that the minimum distance of a Hamming code is exactly 3.
Corollary 1: The Hamming code is capable of correcting all the error patterns of weight one and is capable of detecting all 2 or fewer errors. Proof:

GENERATOR MATRICES
When we use PCB we encode a message 1 2 To generalize this notion we add more than one check bit and encode the message 1 (I.e.) The column of 1's is added to 3 I . 3 ( / ) G I A = . Where Consider the encoding using triple repetition for 3 bit messages as follows. 3 3 3 ( | | ) G I I I = .
The binary codes formed using the generator matrix have the closure property. They are therefore linear codes. I.e. consider 1 y and 2 y codewords generated by G. x G x G y y = + = + .

Parity Check Matrices
A simple way to detect errors is by use of parity check bit (PCB).
A parity bit, or check bit 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 forms of error detecting code. There are two types of parity bits: even parity bit and odd parity bit. 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. Because of its simplicity, parity is used in many hardware applications where an operation can be repeated in case of difficulty, or where simply detecting the error is helpful. In serial data transmission, a common format is 7 data bit, an even parity bit, and one or two stop bits. This format neatly accommodates all the 7-bit ASCII characters in a convenient 8-bit byte.
If a bit string contains an even number of 1s we put 0 at the end.
If it contains an odd number of 1s we put a 1 at the end. Our aim is to ensure an even number of 1s in any codeword.
I.e. message 1  We notice that, when an even number of errors occur, it is not noticed.
Suppose a PCB is added to a bit string during transmission, what would you conclude on the following received messages.
a 101011101 -It contains an even number of 1s. Hence it is either a valid codeword or contains an even number of errors. b 11110010111001 -It contains an odd number of 1s hence it cannot be a valid codeword and must therefore contain an odd number of errors. Consider the generator matrix 100111 010110 001101 the bit string 1 2 3 x x x is encoded as 1 2 3 4 5 6 x x x x x x where:

Syndrome & Error Detection/Correction
The parity check matrix is used to detect errors. Any received bit string y that does not satisfy the equation, is not a valid codeword, that is, it is in error. When the columns of the parity check matrix are distinct and are all non-zero, H can be used to correct the errors. Suppose x is sent and y received in error then y = x + e, e being the error string.
If e = 0 then no error.
In general the error string e has a 1 in the position where y differs from x and 0 in all other places. Hy He c = = . Where j c is the j th column of H .
Assuming no more than one error exists, we can find the codeword x that was send by simply computing t Hy . If t Hy = 0, then no error and y is the sent codeword. Otherwise the th j bit is in error and should be changed to produce x.
Example 7: Obtain H. Determine the codeword sent given the received: y = 001111 y = 010001 Assuming no more than one error. Solution Where A = t Hy .
is the 1st column. Hence the 1st bit string received is in error. 010001 y = .

Cyclic Codes
Cyclic codes form an important subclass of linear block codes and were first studied by Prange in 1957. These codes are popular for two main reasons: first, they are very effective for error detection/correction and second, they possess many algebraic properties that simplify the encoding and the decoding implementations.
A code C is said to be cyclic if: i. C is a linear code.
ii. Whenever a right or left shift is performed on any codeword it yields another codeword. i.e. whenever 0 1 Hence, the code C is a cyclic.
Correspondence between bit string and polynomials over The key to algebraic treatment of cyclic code is the correspondence between the word  i.e.  The equivalence classes form a ring, and iff F(x) is reducible we get a field.

Shift-Register Encoders for Cyclic Codes
In this section we present circuits for performing the encoding operation by presenting circuits for computing polynomial multiplication and division.
Hence, we shall show that every cyclic code can be encoded with a simple finite-state machine called a shift-register encoder.
To define the shift register we want to by the following definition; Definition 4: A D flip-flop is a one-bit memory storage in the field (2) GF . External clock: Not pictured in our simplified circuit diagrams, but an important part of them, which generates a timing signal ("tick") every 0 t seconds. When the clock ticks, the content of each flip-flop is shifted out of the flip-flop in the direction of the arrow, through the circuit to the next flip-flop.
The signal then stops until the next tick. Adder: The symbol of adder has two inputs and one output, which is computed as the sum of the inputs (modulo 2-addition Multiplication: The symbol of multiplication has one input and one output, where the output is the multiplication of the input and the number i g which is stored in this symbol (either 1 or 0), where 0 represented by no connection and 1 by a connection.  All the flip-flops are driven by a common clock, and all are set or reset simultaneously.

Cyclic Codes Decoding
Decoding of cyclic codes consists of the same three steps as for decoding linear codes: a Syndrome computation. b Association of the syndrome to an error pattern. c Error correction. For any linear code, we can form a standard array, or we can use the reduced standard array using syndromes. For cyclic codes it is possible to exploit the cyclic structure of the code to decrease the memory requirements.
First we must determine if the received word r is a codeword in C or not using a Theorem which states that an ( ) r x C ∈ if and only if If ( ) r x C ∉ we determine the closest codeword in ( , ) C n k using the syndrome of as r(x) follows: Since every valid received code polynomial ( ) r x must be a multiple of the generator polynomial ( ) Thus we can employ the division algorithm to obtain a syndrome as follows: ( ) ( ) ( ) ( ) r x a x g x s x = + where ( ) a x is the quotient and ( ) s x is the remainder polynomial having degree less than the degree of ( ) g x : Thus, to compute the syndrome we can use a circuit.

Applications
This study is applicable in:

Conclusion
Decoding can be accomplished in the following manner: i. If ( ) 0 s r = , then we assume that no error occurred. ii. If ( ) 0 s r ≠ and it contains odd number of 1's, we assume that a single error occurred. The error pattern of a single error that corresponds to s is added to the received word for error correction.
iii. If ( ) 0 s r ≠ and it contains even number of 1's, an uncorrectable error pattern has been detected.

Recommendation
Hamming code corrects only the error patterns of single error and is capable of detecting all 2 or fewer errors hence finding a way to correct more than one error and detect more than two errors would be effective.
All error detection, correction controlling mechanisms has been studied. Hamming code is most efficient error correction mechanism in long distance communication. Interesting area of future research is the study of how the presence of caches would affect the correlation in the data input to the ECC memory, and whether there is any systematic pattern there that can be exploited by the optimization algorithms