Hamming live

Encode some bits with Hamming of any size, from (7,4) to (31,26), and see which positions each parity bit watches. Then break a bit with a tap and watch the syndrome find it and correct it; or break two and watch it get it wrong. With even or odd parity, as in the exam. It runs in your browser, on your phone too.

How to use it

  1. Choose Encode and send or Check what arrives, and the parity (even or odd).
  2. Type the information bits (the rightmost is d1) or the word that arrives (from position n to 1). Or pick an example: the TV remote, the exam-style question, a word that arrives fine, two flipped bits or a (15,11).
  3. In what arrives, tap a bit to flip it, like the sun through the window. You can flip several.
  4. Press Step: how many parity bits are needed, where each one goes, which group it watches, the check of each group, the syndrome and the correction.

How it works

The word is written from position n to 1. The parity bits go in the powers of 2 (1, 2, 4, 8…) and each one watches the positions with that 1 in binary: p1 the odd ones, p2 positions 2, 3, 6, 7… The information goes in the rest, with d1 at position 3.

When checking, each group counts its ones together with its parity bit; the positions of the groups that fail are added up and that sum is the position of the wrong bit. The functions are those of topic 7, checked on 20,000 words with 0, 1 and 2 errors.

The rules it follows

  • p parity bits are needed, with 2p ≥ k + p + 1 for k information bits.
  • It corrects one error (distance 3). With two errors the syndrome points to another bit, or to a position that does not exist, and the information comes out wrong.
  • Odd parity flips every parity bit compared with even parity.

For the exam

The exam question gives a received word with its parity and asks for the wrong bit and the information, or asks you to encode some bits. Do it on paper and check it here; the challenge below gives you new words.