Hamming Code, explained.
A Hamming(7,4) code encodes four data bits with three parity bits, allowing correction of any single-bit transmission error under the single-error assumption.
Why it happens
Data occupies positions 3,5,6,7 and even parity positions 1,2,4. Toggle errors, XOR positions of received one bits to get a syndrome, flip that position if nonzero and read data. Compare recovered data with the known original; the decoder does not know the injected-error count.
A Hamming(7,4) code encodes four data bits with three parity bits, allowing correction of any single-bit transmission error under the single-error assumption.
Read the result
Distinguish injected errors known by the simulator from the syndrome known by the decoder. A nonzero syndrome is interpreted under a one-error assumption.
A worked example
One damaged bit and then two
Encode the default four data bits and flip one transmission bit before decoding; compare the recovered data with the original.
Reset, flip two different transmission bits and decode again using the same single-error correction rule.
Inspect a possible mismatch: a two-error syndrome can point to a third position, causing a wrong correction instead of identifying both errors.
OPTIONAL DEEPER DETAILGo deeper: inside the model
Inside this model
Data occupies positions 3,5,6,7 and even parity positions 1,2,4. Toggle errors, XOR positions of received one bits to get a syndrome, flip that position if nonzero and read data. Compare recovered data with the known original; the decoder does not know the injected-error count.
Where this idea is useful
A practical use
Redundant structure can recover information from noise while still having a precise limit on the errors it can correct.
A common misconception
“Adding parity makes any corrupted message recoverable.”
Codes have precise distance-based limits. Hamming(7,4) corrects one error; this decoder cannot reliably distinguish a single error from multiple errors without extra structure.
What this explanation leaves out
- Two errors can cause this single-error decoder to miscorrect. The simulator's injected count is extra ground truth, not a decoder capability. Extended SECDED adds another parity bit; no real communication channel is being tested.
Why display the original data if a receiver would not know it?
The original is simulator ground truth for checking the demonstration. It is not supplied to the decoding calculation and does not improve the code's capabilities.
What failure does your redundancy scheme detect, and what failure can it actually repair?
Associated thinkers
Associations marked provisional are awaiting source review.
Further reading
Explore the original research or the teaching reference behind this experiment.