Walsh-Hadamard error correction code that encodes k bits into 2^k bits. Can correct up to (2^(k-1) - 1) / 2 errors. Used in Mariner 9 spacecraft and CDMA communication. Highly redundant but powerful for low-rate applications.
| Property | Value |
|---|---|
| Category | Error Correction |
| Sub-category | Linear Code |
| Security status | 🎓 Educational Only |
| Complexity | Intermediate |
| Inventor | Jacques Hadamard (matrix), Joseph L. Walsh (functions) |
| Year | 1893 |
| Origin | 🇫🇷 France |
| Source | algorithms/ecc/hadamard-code.js |
Status: 🎓 Educational Only
| Issue | Description | Mitigation |
|---|---|---|
| Very Low Code Rate | Code rate is k/2^k, extremely inefficient for large k. Example: k=6 gives rate 6/64 = 9.4%. | — |
| Power-of-2 Constraint | Message length must be a power of 2, limiting flexibility. | — |
4 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 — Hadamard (8,3) all zeros
| Field | Value |
|---|---|
input |
000000 |
expected |
0000000000000000 |
Vector 2 — Hadamard (8,3) pattern 001
| Field | Value |
|---|---|
input |
000001 |
expected |
0001000100010001 |
Vector 3 — Hadamard (8,3) pattern 010
| Field | Value |
|---|---|
input |
000100 |
expected |
0000010100000101 |
Vector 4 — Hadamard (8,3) all ones
| Field | Value |
|---|---|
input |
010101 |
expected |
0001010001000001 |