Classical polygraphic substitution cipher using linear algebra with matrix multiplication modulo 26. Encrypts blocks of letters using matrix operations. Invented by Lester S. Hill in 1929, requires matrix to be invertible mod 26.
| Property | Value |
|---|---|
| Category | Classical Ciphers |
| Sub-category | Classical Cipher |
| Security status | π Educational Only |
| Complexity | Expert |
| Inventor | Lester S. Hill |
| Year | 1929 |
| Origin | πΊπΈ United States |
| Source | algorithms/classical/hill.js |
Status: π Educational Only
| Issue | Description | Mitigation |
|---|---|---|
| If enough plaintext-ciphertext pairs are known, the key matrix can be recovered using linear algebra | β | Requires n known plaintext blocks for nΓn matrix, but still vulnerable |
| While more resistant than monoalphabetic ciphers, still vulnerable to advanced frequency analysis | β | Educational use only - modern ciphers provide much better security |
4 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 β Wikipedia worked 2x2 example - HELP under [[3,3],[2,5]]
| Field | Value |
|---|---|
key |
332c332c322c35 |
input |
48454c50 |
expected |
48494154 |
Vector 2 β Wikipedia worked 3x3 example - ACT under [[6,24,1],[13,16,10],[20,17,15]]
| Field | Value |
|---|---|
key |
362c32342c312c31332c31362c31302c32302c31372c3135 |
input |
414354 |
expected |
504f48 |
Vector 3 β Wikipedia worked 3x3 example - CAT under the same matrix
| Field | Value |
|---|---|
key |
362c32342c312c31332c31362c31302c32302c31372c3135 |
input |
434154 |
expected |
46494e |
| Field | Value |
|---|---|
key |
332c322c352c37 |
input |
48454c4c4f |
expected |
444c44434b58 |