Hawkynt

Hamming Code

Parametrized Hamming error correction codes supporting standard (7,4), (15,11), (31,26) variants, extended SECDED variants with overall parity, and shortened versions. Single-bit error correction using parity bits at power-of-2 positions.

Properties

Property Value
Category Error Correction
Sub-category Linear Code
Security status πŸŽ“ Educational Only
Complexity Intermediate
Inventor Richard Hamming
Year 1950
Origin πŸ‡ΊπŸ‡Έ United States
Source algorithms/ecc/hamming.js

Security

Status: πŸŽ“ Educational Only

Known vulnerabilities

Issue Description Mitigation
Single Error Correction Only Standard Hamming codes can only correct single-bit errors. Extended versions (SECDED) can detect double errors. β€”
Limited Error Detection Cannot reliably detect burst errors or certain patterns of multiple errors. β€”

Documentation

References

Test vectors

7 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.

Vector 1 β€” Hamming (7,4) all zeros

Field Value
input 00000000
expected 00000000000000

Vector 2 β€” Hamming (7,4) all ones

Field Value
input 01010101
expected 01010101010101

Vector 3 β€” Hamming (7,4) pattern

Field Value
input 01000100
expected 01000101000100

Vector 4 β€” Extended Hamming (8,4) SECDED zeros

Field Value
parityBits 3
extended Yes
input 00000000
expected 0000000000000000

Vector 5 β€” Extended Hamming (8,4) SECDED ones

Field Value
parityBits 3
extended Yes
input 01010101
expected 0101010101010101

Vector 6 β€” Shortened Hamming (6,3) zeros

Field Value
parityBits 3
shortened 1
input 000000
expected 000000000000

Vector 7 β€” Shortened Hamming (6,3) pattern

Field Value
parityBits 3
shortened 1
input 010001
expected 010001010001

← All algorithms