In the first algorithm he invented, he wrote each bit three times, so if one of the three was incorrect, the error can be corrected, since there were two more correct bits. The great advantage of this method is that it is very easy to apply. However, ⅔ from the data is used for the redundancy, which made the algorithm inefficient.
Finally, he invented an algorithm that uses parity bits located in numbers that their index is a power of 2. They indicate whether the number of times the digit 1 appears is even or odd. Each bit in the given codeword is covered by at least 2 parity bits. Therefore, it is possible to verify which relationship bits are incorrect, their amount will indicate the position of the incorrect bit. With the help of the relationship bits it is possible to identify if there is an error, and to correct it.
Bit Number | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Original Msg. | P1 | P2 | 0 | P4 | 1 | 1 | 0 | P4 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
Parity Bits Of: | 1,3,5,7,9,11,13,15 | 2,3,6,7,10,11,14,15 | 4,5,6,7,12,14,15 | 8,9,10,11,12,14,15 | |||||||||||
Encoded Data: | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
When running the program you will be prompted to choose between 2 options:
- The first will allow the user to enter data that is 11 bits and the program will return its 15 bit Hamming Code, with four added parity bits.
- The other option allows the user to enter a 15 bit Hamming Code, and it will print if there was any error in the data and return the corrected Hamming Code.
- The user can also choose to generate or correct a SECDED Hamming Code with an extra parity bit.
- Hamming Code, Wikipedia.
- Calculating and Correcting Hamming Codes. (1999). Florida International Univercity.
- Chapter 5: Memory & Hamming/SECDED Codes, Intro to Computer Systems. (2014). RMIT Univercity.
- Error Detecting and Error Correcting Codes. (1950). Richard Hamming, Bell Lab's Journal.
- Hamming codes and error correction, (2020). 3Blue1Brown Youtube chanel.