I have been trying to understand Hamming Codes and wrote a program that correctly encodes and decodes given inputs for Hamming 7,4. When trying to do this for 15,11 I cannot get the right output when trying to encode.
I inputted the byte and added three leading zeros then multiplied it by the generator matrix below. After taking mod2 of the matrix I still am not getting the correct answer and am not sure if I am doing something wrong or if my matrix is incorrect.
int [][] byte = {{0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1}};
int [][] matrixG = { { 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1} };
Hamming codes are a very new concept to me so I may be missing something very obvious! I really appreciate any help you can give me!
x^4 + x + 1
, which corresponds to1 0 0 1 1
cyclic code, instead of1 1 0 0 1
in your matrix – sw0rdf1sh