### Encoding and Error

Hamming Code
Rachel Ah Chuen
Basic concepts
• Networks must be able to transfer data from one device
to another with complete accuracy.
• Data can be corrupted during transmission.
• For reliable communication, errors must be detected and
corrected.
Types of Errors
Single-bit error
Single-bit error
 Single bit errors are the least likely type of errors in
serial data transmission because the noise must
have a very short duration which is very rare.
 However this kind of errors can happen in parallel
transmission.
Burst error
Burst error
 The term burst error means that two or more bits
in the data unit have changed from 1 to 0 or from
0 to 1.
 Burst errors does not necessarily mean that the
errors occur in consecutive bits.
 The length of the burst is measured from the first
corrupted bit to the last corrupted bit.
Hamming Code
 In the late 1940’s Richard Hamming recognized
that the further evolution of computers required
greater reliability, in particular the ability to not
only detect errors, but correct them.
 His search for error-correcting codes led to the
Hamming Codes, and the extended Hamming
Codes, 1-error correcting and 2-error detecting
codes.
Definitions
 For linear codes, encoding is a linear
transformation c that maps a message m to a
codeword c(m).
 Block codes means all codewords c(m) have the
same length, which we denote as n.
 Let k be the length of information bits that we
encode. Then there are n-k redundancy bits in
each codeword, called parity check bits, which
are left for error correction.
 (n, k) specify the parameters (codeword length
and parity check bit length) for a block code.
Hamming Distance
 The Hamming distance, d_H is the number of bits
that have to be changed to get from one bit
pattern to another.
 Example: c1=(10010101) & c2=(10011001) have a
hamming distance of 2
 What about c1 = (101101) and c2 = (100110)?
Minimum Hamming
Distance
 Let d to be the minimum Hamming distance
between any two distinct codewords of a code
C as
 A code with minimum distance d between
codewords can detect d-1 errors and can
correct (d-1)/2 errors.
Hamming weight
 w(S) defined as the sum of its non-zero entries
 A linear code is completely defined by all the
codewords for messages of weight 1.
Hamming Code
 The Hamming code is a single error correction
linear block code with (n, k) = (2m -1, 2m-1-m)
 where m = n k is the number of check bits in the
codeword.
 The simplest non-trivial code is for m = 3, which is
the (7,4) Hamming code.
 Generator matrix
 Where S is k x (n k)
Hamming code
 Suppose our matrix G generates a
single error correcting code. Then
there are no code words of weight 1
or 2, and the parity check portion S of
G must satisfy the following 2
conditions:
(7,4) Hamming Code
(7,4) Hamming Code
 For every generator matrix g=[ I S], there is a
parity check matrix H defined by
Example
 received string r = (1110111)
Parity Errors
 The class of Hamming single error correcting
codes is noteworthy because they are
particularly efﬁcient in the use of parity bits.
 The (7,4) Hamming code uses 3 parity bits to
protect 4 data bits;
(15,11) code
Parity Computation
 (7,4) code