Dulranga's Notes
Semester 3Data Communication and Networking

Hamming Codes

Used to detect 1 Bit Errors and fix them. Single parity bit can detect an error but cannot be fixed. Hamming codes use multiple parity bits to detect if there is an error and where that error occurs.

No. of parity bits required scales logarithmically over no. of bits. So this scheme is efficient for large codewords of transfers.

Amount of parity bits (rr) required:

2r≥m+r+12^r \ge m + r + 1
  • mm is the number of data (message) bits.
  • rr is the number of parity bits.
  • The right-hand side counts the situations the receiver must tell apart: "no error", or "error in one of the m+rm+r positions".
  • The rr parity checks give 2r2^r possible patterns, so there must be at least that many patterns.

(7,4) SEC Hamming Code

7 Bits, 4 Message Bits Single Error Correcting Hamming Code

Pasted image 20261111124046.png

  • Parity bits are always inserted into places where only One 11 bit is indicating the bit position. Which are …,4,2,1\dots, 4,2,1 reason: We do not want the parity bit values of one bit to change another parity bit value.

  • Other positions hold message bit values

  • Each parity bit checks only the positions there are 11s in the position bits in its row. Value of each position will be used to calculate the value of parity bit. Example: p1p_1 checks 7,5,37, 5, 3 bit positions p2p_2 checks 7,6,37, 6, 3 bit positions p3p_3 checks 7,6,57, 6, 5 bit positions So Each bit position is checked by at least two parity bits. If two parity bits are wrong, we know which position that is. If all three parity bits are wrong, that is position 77

    Pasted image 20261111130456.png

On this page