0% found this document useful (0 votes)
0 views

Complete_Hamming_Code_Notes

Hamming Code is an error-detection and correction method that uses redundant bits to ensure data integrity in networking. It involves placing parity bits at specific positions, calculating them using even or odd parity, and allows for the correction of single-bit errors and detection of two-bit errors. While effective, it cannot correct more than one-bit errors and is not suitable for burst errors.

Uploaded by

xabah70709
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Complete_Hamming_Code_Notes

Hamming Code is an error-detection and correction method that uses redundant bits to ensure data integrity in networking. It involves placing parity bits at specific positions, calculating them using even or odd parity, and allows for the correction of single-bit errors and detection of two-bit errors. While effective, it cannot correct more than one-bit errors and is not suitable for burst errors.

Uploaded by

xabah70709
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Complete Notes on Hamming Code

HAMMING CODE IN NETWORKING

INTRODUCTION:
Hamming Code is an error-detection and correction method developed by Richard Hamming. It is widely used in di

KEY CONCEPTS:
- Redundant Bits (Parity Bits): Extra bits added to the original data.
- Positions that are powers of 2 (1, 2, 4, 8, etc.) are reserved for parity bits.
- Remaining positions are filled with data bits.
- Parity bits are calculated using even or odd parity.

NUMBER OF REDUNDANT BITS (r):


To find the number of redundant bits:
2^r >= m + r + 1
Where:
m = Number of data bits
r = Number of redundant bits

STEPS TO ENCODE USING HAMMING CODE:


1. Determine the number of redundant bits.
2. Place parity bits at positions 2^n and data bits in remaining positions.
3. Calculate parity bits using even parity.
4. Transmit the Hamming code.
5. At the receiver, recalculate parity to detect and correct any error.

EXAMPLE 1: 4-BIT DATA – 1011


Step 1: m = 4, r = 3 (since 2^3 = 8 >= 4 + 3 + 1)
Bit positions: 1(P1), 2(P2), 3(D1), 4(P4), 5(D2), 6(D3), 7(D4)
Data: D1=1, D2=0, D3=1, D4=1
Calculate parity bits:
P1 (1,3,5,7) = 1+0+1 = Even => P1=0
P2 (2,3,6,7) = 1+1+1 = Odd => P2=1
P4 (4,5,6,7) = 0+1+1 = Even => P4=0
Final code: 0110011

EXAMPLE 2: DETECT AND CORRECT ERROR


Received Code: 0111011
Check parity:
P1 => Error
P2 => Error
P4 => Error
Binary of parity error = 111 = 7 => Error at position 7
Flip bit at position 7: 1 -> 0
Corrected Code: 0110011

EXAMPLE 3: 7-BIT DATA – 1101101


m = 7, r = 4 (2^4 = 16 >= 7+4+1)
Bit positions: 1(P1), 2(P2), 3(D1), 4(P4), 5(D2), 6(D3), 7(D4), 8(P8), 9(D5), 10(D6), 11(D7)
Data bits: 1 1 0 1 1 0 1
P1: positions 1,3,5,7,9,11 = 1 (odd)
P2: positions 2,3,6,7,10,11 = 1 (odd)
P4: positions 4,5,6,7 = 0 (even)
P8: positions 8,9,10,11 = 0 (even)
Final Code: 11101010101

Assume error at position 6 → Received: 11101110101


Check parity:
P1: OK
P2: Error
P4: Error
P8: OK
Error Position: 0110 (binary) = 6
Corrected Code: 11101010101

ADVANTAGES:
- Corrects single-bit errors
- Detects two-bit errors
- Efficient and simple to implement

LIMITATIONS:
- Cannot correct more than one-bit error
- Not suitable for burst errors

APPLICATIONS:
- Digital communication
- Computer memory (RAM)
- Networking protocols

CONCLUSION:
Hamming Code is a powerful technique for ensuring data integrity in network communication and memory systems

You might also like