Hamming codes are a family of error correction (1 bit) and error detection (2 bits) linear codes. The minimum distance (ie Hamming distance) between codewords in a Hamming code is 3.

For each integer there is a binary code of block length: vectors

and a message length:

giving a coding rate:

Hamming codes have parity checking matrices the columns of which consist of all the non-zero vectors of length .

Hence for a Hamming code the parity check matrix would be:

Which, (if I have done this correctly!), can give us a generator matrix:

The first three columns form an identity matrix, allowing us to use the first three bits of the received code as the original message.

(One interesting point to note is that we can run this process in reverse to compress data in a lossy form – eg we could compress 7 bits into three bits using this Hamming code, provided we were willing to tolerate the errors/losses.)

###### Related articles

- RAID Levels Explained. (maliazeem.wordpress.com)
- Ham It Up (drdobbs.com)