Hawkynt

Hill Cipher

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.

Properties

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

Security

Status: πŸŽ“ Educational Only

Known vulnerabilities

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

Documentation

References

Test vectors

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

Vector 4 β€” Padding case - odd-length text filled out to the block size with X. No published source carries this value; it is here to keep the padding path covered

Field Value
key 332c322c352c37
input 48454c4c4f
expected 444c44434b58

← All algorithms