# Hamming code error correction

I'm currently learning how Hamming codes work and so far I am understanding it!

I have worked through several examples, and it seems to work well following the below table:

Where I get stuck however is when I have an example which its length means it ends on a parity bit. For example:

1001010011010011


Ignore the meaning of obviously random binary string above, but the fact that it is 16 bits long, when you are error checking it, you start with p1 and then do p2, p4, p8 and finally p16. What I don't understand however, is that as there are no digits after position 16, how am I meant to work out if p16 is correct or not. If the string was 20 bits long, I know you just count 16 and skip 16, starting at p16. However as there are no bits after p16 I am a bit stuck.

If anyone has any idea, that would be awesome!

Thanks

-
This code has 15 bits of data, plus 5 of redundacy (parity), giving a total of 20 bits per encoded symbol. To decode each symbol you need 20 bits. I don't understand why you are given 16 bits to decode, and what are you supposed to do with that. –  leonbloy Apr 9 '13 at 14:17
The table above shows how to error correct up to 20 bits, but the symbol doesn't have to be 20 bits. For example the code word 110110001010 without the parity bits would be 01001010. The original code word can be error corrected using p1, p2, p4 and p8. My problem is not knowing how to error correct a symbol of 16 bits. –  Luke Presland Apr 9 '13 at 14:36
No. The table above is general, in the sense that it can be used to generate a coding scheme for different sizes. But you must fix that size (raw data size and encoded size) beforehand, and the decoder must know it. –  leonbloy Apr 9 '13 at 14:41
Indeed. The example I am stuck on is a fixed length of 16 bits. I'm not sure if I'm just not explaining this correctly, but I have worked through examples of 12 bits, which I understand. But 16 bits is just confusing. –  Luke Presland Apr 9 '13 at 14:46