Hamming Code Presentation
Hamming Code Presentation
CONTENT
INTRO S ENDIN
& G
ORIGIN NOTES
HAMMI MATHS
NG INTUITI
INSIGH ON
BINARY
TS INTUITI
Any file is stored in binary form
Original File’s Binary(bits)
Original Image File
Form
0 0 1 1 1 0 1 1 0 1
ORIGIN
INTRO &
1 0 0 1 0 1 1 1 0 0
1 1 0 1 1 0 0 1 1 0
0 0 0 1 1 0 1 0 0 1
File’s Sequential
0 1 1 0 1 1 0 1 1 0 Arrangement
1 1 0 0 1 0 1 1 0 1 00111011011001010…
1 1 1 0 0 1 1 0 1 0
ORIGIN
INTRO &
What can we do ?
Richard W. Hamming
00 01 12 13 00 01 12 13
INSIGHTS
HAMMING
14 05 16 07 NOISE 14 05 16 07
SENDER
RECEIVER
08 09 1 10 0 11 08 09 1 10 0 11
1 12 0 13 0 14 1 15 1 12 0 13 0 14 1 15
16-Bits Block 12 (~11) -Bits of Data
04-Bits for Redundancy
Method to detect the error but not correct it – PARITY CHECK
INSIGHTS
HAMMING
(a.k.a Parity Bit) necessarily mean there is only
one error; there might be more
14 05 16 07 The rest contain than 3 or 5 or 11 or any other
odd number of errors.
message
• Similarly if Receiver sees Even
08 09 1 10 0 11 Task : Count the # of 1’s
Parity it does not necessarily
imply that there are no errors.
Even 1’s Parity Bit (0)
0 12 1 13 1 14 1 15 Odd 1’s Parity Bit (1)
• Parity check will fail for
messages more than 1 flips
(i.e., 2 or 4 or any other even
number flips) and it is not easy
to detect these flips since the
parity bit will remain 0.
INSIGHTS
HAMMING
Subsets of the message
Assumption: There is at-most 1 Error
in the complete block
10 01 02 13 OR
04 15 06 07
OR
08 19 0 10 1 11
OR
1 12 0 13 1 14 1 15
10 01 02 13
OR
04 15 06 07
INSIGHTS
HAMMING
0 8 1 9 0 10 1 11
1 12 0 13 1 14 1 15 OR
Parity Bit
10 11 02 13 OR
04 15 06 07
0 8 1 9 0 10 1 11
OR
1 12 0 13 1 14 1 15
10 11 02 13
04 15 06 17
INSIGHTS
HAMMING
OR
0 8 1 9 0 10 1 11
1 12 0 13 1 14 1 15
INSIGHTS
HAMMING
0 8 1 9 0 10 1 11
1 12 0 13 1 14 1 15 OR
Parity Bit
10 01 02 13 OR
04 15 06 07
0 8 1 9 0 10 1 11
OR
1 12 0 13 1 14 1 15
10 01 02 13
OR
04 15 06 07
INSIGHTS
HAMMING
0 8 1 9 0 10 1 11
1 12 0 13 1 14 1 15 OR
Parity Bit
10 01 02 13 OR
04 15 06 07
0 8 1 9 0 10 1 11
OR
1 12 0 13 1 14 1 15
10 01 02 13
OR
INSIGHTS
HAMMING
04 15 06 07
0 8 1 9 0 10 1 11
1 12 0 13 1 14 1 15 OR
Parity Bit
10 01 02 13 OR
04 15 06 07
18 1 9 0 10 1 11
OR
1 12 0 13 1 14 1 15
HAMMING
INSIGHTS
HAMMING
INSIGHTS
HAMMING
INSIGHTS
…
…
Ability to Scale What happens if Parity Bit changes
INSIGHTS
HAMMING
Well in that case also, we carry out
similar procedure. However our main
concern is regarding the message not
the parity bit. Hence it does not matter
at the end of the day.
Why are the Parity bits sitting in the positions What to do with the 0th Parity Bit ?
which are power of 2 ??
Why this ? Why not this ? (15,11) Hamming Code Extended Hamming
Code
The position which are power of 2 are such that 15 – Bit Block Use it to detect 2-bit
they correspond to exactly one and only one of 11 – Bits of Message error by performing
the four parity groups. Hence it is logical to 4 – Bits Redundancy normal parity check
consider position that are power of 2. on the whole block.
7
INTUITION
BINARY
1 1 1 0
0111 7
(YES) (YES) (YES) (NO)
For an error condition, does the
position contain 1 in it’s unit place
(_ _ _ 1 ) ?
0000 0001 0010 0011
Also note, the positions
For an error condition, does the which are power of 2
position contain 1 in it’s ten’s that are taken as Parity
place (_ _ 1 _) ? Bit, it’s binary represe-
0100 0101 0110 0111
-ntation has only a
For an error condition, does the single bit turned on
position contain 1 in it’s hundred’s (i.e., contains only 1)
1000 1001 1010 1011 place (_ 1 _ _ ) ?