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.
| 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 |
Status: π Educational Only
| 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. | β |
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 |