Classical Cryptography
Hill Cipher
The Hill Cipher is a matrix-based polygraphic substitution cipher. It encrypts blocks of letters using matrix multiplication modulo 26.
Algorithm Steps
- 1Choose a valid 2x2 key matrix.
- 2Convert plaintext letters to numbers.
- 3Divide text into pairs.
- 4Multiply each pair by the key matrix.
- 5Apply modulo 26.
- 6Convert numbers back to letters.
Formula
Encryption: C = K × P mod 26 Decryption: P = K⁻¹ × C mod 26
Example
Plaintext: HELP Key Matrix: [[3, 3], [2, 5]] Encrypted text: HIAT Decrypted text: HELP