Hamming CodeProject

C++

Hamming code is a set of error-correction codes that can be used to detect and correct the errors that can occur when the data is moved or stored from the sender to the receiver. It is technique developed by R.W. Hamming for error correction.

Steps:

  1. Calculation of the number of redundant bits.
  2. Positioning the redundant bits.
  3. The r redundant bits placed at bit positions of powers of 2

  4. Parity checking.
  5. Parity bits are calculated based upon the data bits and the redundant bits using the same rule as during generation of c1,c2 ,c3 ,c4 etc

  6. Error detection and correction
  7. The decimal equivalent of the parity bit's binary values is calculated. If it is 0, there is no error. Otherwise, the decimal value gives the bit position which has error. The bit is flipped to get the correct message.

2^r ≥ m + r + 1 =>> where, r = redundant bit, m = data bit

Here you can try it: