Error Correcting Codes - Hamming Codes
Error Correcting Codes - Hamming Codes
When bits are transmitted over the computer network, they are subject to get corrupted due to
interference and network problems. The corrupted bits leads to spurious data being received
by the receiver and are called errors.
Error-correcting codes (ECC) are a sequence of numbers generated by specific algorithms for
detecting and removing errors in data that has been transmitted over noisy channels. Error
correcting codes ascertain the exact number of bits that has been corrupted and the location of
the corrupted bits, within the limitations in algorithm.
Block codes − The message is divided into fixed-sized blocks of bits, to which redundant
bits are added for error detection or correction.
Convolutional codes − The message comprises of data streams of arbitrary length and
parity symbols are generated by the sliding application of a Boolean function to the data
stream.
Hamming Code
Hamming code is a block code that is capable of detecting up to two simultaneous bit errors
and correcting single-bit errors. It was developed by R.W. Hamming for error correction.
In this coding method, the source encodes the message by inserting redundant bits within the
message. These redundant bits are extra bits that are generated and inserted at specific
positions in the message itself to enable error detection and correction. When the destination
receives this message, it performs recalculations to detect errors and find the bit position that
has error.
Once the redundant bits are embedded within the message, this is sent to the user.
Even Parity − Here the total number of bits in the message is made even.
Odd Parity − Here the total number of bits in the message is made odd.
Each redundant bit, ri, is calculated as the parity, generally even parity, based upon its bit
position. It covers all bit positions whose binary representation includes a 1 in the ith position
except the position of ri. Thus −
r1 is the parity bit for all data bits in positions whose binary representation includes a 1 in
the least significant position excluding 1 (3, 5, 7, 9, 11 and so on)
r2 is the parity bit for all data bits in positions whose binary representation includes a 1 in
the position 2 from right except 2 (3, 6, 7, 10, 11 and so on)
r3 is the parity bit for all data bits in positions whose binary representation includes a 1 in
the position 3 from right except 4 (5-7, 12-15, 20-23 and so on)
2r ≥ m + r + 1 where m is the number of data bits and r is the number of redundant bits.
Step 2 − Positioning the redundant bits
The r redundant bits placed at bit positions of powers of 2, i.e. 1, 2, 4, 8, 16 etc.
AD