- This cipher is based on linear algebra.
- Each letter is represented by numbers from 0 to 25 and calculations are done modulo 26.
- This encryption algorithm takes m successive plaintext letters and substitutes them with m cipher text
- The substitution determined by m linear equations. For m = 3, the system can describe as:
C1 = (k11p1 + k12p2 + k13p3) mod 26
C2 = (k21p1 + k22p2 + k23p3) mod 26
C3 = (k31p1 + k32p2 + k33p3) mod 26
This can also expressed in terms of row vectors and matrices.
- Where C and P are row vectors of length 3 representing the plaintext and ciphertext, and K is a 3 X 3 matrix representing the encryption key
- Key is an invertible matrix K modulo 26, of size m. For example:
Encryption and decryption can give by the following formulae: Hill Cipher
Encryption: C = PK mod 26
Decryption: P = CK-1 mod 26
- The strength of the Hill cipher is that it completely hides single-letter frequencies.
- Although the Hill cipher strong against a cipher text-only attack, it easily broke with a known plaintext attack.
- Collect m pair of plaintext-cipher text, where m is the size of the key.
- Write the m plaintexts as the rows of a square matrix P of size m.
- Write the m ciphertexts as the rows of a square matrix C of size m.
- We have that C=PK mod 26.
- If P is invertible, then K=13-1C mod 26,
- If P is not invertible, then collect more plaintext-ciphertext pairs until an invertible P obtained.
The Vigenere cipher: Hill Cipher
- This is a type of polyalphabetic substitution cipher (includes multiple substitutions depending on the key). In this type of cipher, the key determines which particular substitution to use.
- To encrypt a message, a key needed that is as long as the message. Usually, the key a repeating
- For example, if the keyword is deceptive, the message “we discovered save yourself” encrypted as follows:
Key: deceptive except
Plaintext: were discovered
Encryption can do by looking in the Vigenere Table where ciphertext is the letter key’s row and plaintext’s column or by the following formula:
- Ci = + Kt mod ni) mod 26
- Moreover, Decryption is equally simple. The key letter again identifies the row. The position of the ciphertext letter in that row determines the column, and the plaintext letter is at the top of that column.
- The strength of this cipher is that there are multiple ciphertext letters for each plaintext letter, one for each unique letter of the keyword.
- Thus, the letter frequency information obscured, however, not all knowledge of the plaintext structure lost.