Substitution ciphers - homophonic, playfair, polyalphabetic Flashcards
What is a homophonic substitution cipher?
For mono-alphabetic you can detect by frequency analysis on how often the letter appears in the plaintext SO countermeasure is to provide multiple substitutes (i.e., homophones) for a single letter to make frequency analysis more difficult.
Mathematical formalisation of a homophonic substitution cipher?
- To each a ∈ A associate a set H(a) of strings of t symbols, where H(a), a ∈ A are pairwise disjoint.
- Replace each a with a randomly chosen string from H(a).
- To decrypt a string c of t symbols, one must determine an a ∈ A such that c ∈ H(a).
- The key for the cipher is the sets H(a).
Why is cryptanalysis still possible with homophonic ciphers?
- There are still multiple letter patterns in the ciphertext.
- Homophonic is better than mono-alphabetic but it is not enough.
What are the two principal methods used in substitution ciphers that lessen the extent to which the structure of plaintext survives in ciphertext?
- encrypt multiple letters of the plaintext - PLAYFAIR
2. use multiple cipher alphabets (polyalphabetic substitution) - VIGENERE
What is the playfair cipher?
- Uses a 5 x 5 matrix of letters constructed using a keyword ( do not include duplicates)
- Fill in the remaining of the matrix with the rest of the letters in alphabetical order (I/J in one cell)
- Plaintext is encrypted two letters at a time - if there is a repeated letter in the pair - use a filler X (“BALLOON” ; “BA LX LO ON”) - process the plaintext as you go along. You can use the filler even at the end to make sure the entire plaintext is separated in pairs.
- Both letters in the pair are in the saw row -> replace with the letter to the right/ wrap around the same row.
- Both letters in the pair are in the same column -> replace it with the letter below it/ wrap around the same column.
- If both the letters in the pair are not in the same row and same column -> replace each letter by the letter in the same row and in the column of the other letter of the pair.
How to decrypt the playfair cipher?
- Both letters in the pair are in the saw row -> replace with the letter to the left/ wrap around the same row.
- Both letters in the pair are in the same column -> replace it with the letter above it/ wrap around the same column.
- Drop the fillers X so that the plaintext makes sense.
What is the security of the playfair cipher?
Security MUCH IMPROVED than mono-alphabetic
- 26 (plaintext) x 26(ciphertext) = 676 diagrams vs. 26 letters.
- Would need a 676 entry frequency table to analyse, and correspondingly more ciphertext.
- Breaking it is still relatively easy
a. a lot of the structure is still preserved/ intact.
b. a few 100 letters of ciphertext are generally sufficient
What is a polyalphabetic substitution cipher?
- DIFFERENT MONO-ALPHABETIC SUBSTITUTIONS AS ONE PROCEEDS THROUGH THE PLAINTEXT MESSAGE.
What are the two features of polyalphabetic substitution ciphers?
- a set of related mono-alphabetic substitution rules is used.
- a key determines which particular rule is chosen for a given transformation.
Explain the Vigenere cipher?
- Set of related monoalphabetic substitution rules consists of the 26 Caesar ciphers with shifts of 0 through 25.
- Each cipher is denoted by a key letter, which is the ciphertext letter that substitutes for the plaintext letter A.
- Therefore, a Caesar cipher with a shift of 3 is denoted by key value D
What are the main details of the Vigenere cipher?
- Assume:
a. a sequence of plaintext letters P = p0, p1, p2, . . . , pn−1,
b. a key consisting of the sequence of letters K = k0, k1, k2, . . . , km−1.
Typically m < n. - Sequence of ciphertext letters C = C0, C1, C2, . . . , Cn−1:
C = C0, C1, C2, . . . , Cn−1
= E(K, P)
= E((k0, k1, k2, . . . , km−1),(p0, p1, p2, . . . , pn−1)) = (p0 + k0) mod 26, (p1 + k1) mod 26, . . . ,(pm−1 + km−1) mod 26, (pm + k0) mod 26, (pm+1 + k1) mod 26,. . .(p2m−1 + km−1) mod 26, . . .
For each letter in the plaintext and the key:
ENCRYPTION: Ci = (pi + ki) mod 26
DECRYPTION: pi = (Ci − ki) mod 26
- First letter of key (k0) is added to the first letter of plaintext P (p0) -> (k0 + p0) mod 26
This carries on until the entire plaintext is encrypted as shown above in step 2. - The KEY HAS TO BE AS LONG AS THE MESSAGE. If not, repeat the key until it is as long as the message.
What are the strengths of the Vigenere cipher?
- There are multiple ciphertext letters for each plaintext characters, one for each unique letter in the keyword/ key.
- Due to this, letter frequency info is hidden.
- HOWEVER, not all knowledge of the plaintext structure is lost BUT better than playfair cipher.