Cipher
Cipher
Shift Cipher
Definition:
o The Shift Cipher, also known as the Caesar Cipher, is a type of substitution cipher in
which each letter in the plaintext is shifted a certain number of places down or up the
alphabet.
Affine Cipher
Definition:
o The Affine Cipher is a type of monoalphabetic substitution cipher where each letter in
an alphabet is mapped to its numeric equivalent, encrypted using a linear
transformation function, and then converted back to a letter.
Substitution Cipher
Definition:
o A Substitution Cipher is a method of encryption where each letter in the plaintext is
replaced with another letter according to a fixed system, creating a ciphertext alphabet.
Frequency Analysis
Definition:
o Frequency Analysis is a cryptanalytic technique used to break substitution ciphers by
studying the frequency of letters or groups of letters in the ciphertext and comparing
them to the expected frequencies in the language.
1. Shift Cipher
Encryption:
Replace each letter in the plaintext with the letter that is k positions further down the alphabet.
Example:
Plaintext: HELLO
Ciphertext:
o H becomes K (H+3)
o E becomes H (E+3)
o L becomes O (L+3)
o L becomes O (L+3)
o O becomes R (O+3)
Ciphertext: KHOOR
Decryption:
Replace each letter in the ciphertext with the letter that is k positions back up the alphabet.
Example:
Ciphertext: KHOOR
Plaintext:
o K becomes H (K-3)
o H becomes E (H-3)
o O becomes L (O-3)
o O becomes L (O-3)
o R becomes O (R-3)
Plaintext: HELLO
2. Affine Cipher
Encryption:
Example:
o L (11) -> D
Ciphertext: RCDDC
Decryption:
D(y) = 𝑎 −1 (y-b)
Example:
Ciphertext: RCDDC
Find
o D (3) -> L
Plaintext: HELLO
3. Substitution Cipher
Encryption:
Replace each letter in the plaintext with the corresponding letter in the substitution alphabet.
Example:
o H becomes I
o E becomes T
o L becomes S
o L becomes S
o O becomes G
Ciphertext: ITSSG
Decryption:
Replace each letter in the ciphertext with the corresponding letter in the original alphabet.
Example:
Ciphertext: ITSSG
Plaintext:
o I becomes H
o T becomes E
o S becomes L
o S becomes L
o G becomes O
Plaintext: HELLO
4. Frequency Analysis
Frequency Analysis is used to break substitution ciphers, including the Shift Cipher and the Affine Cipher.
Process:
1. Count Frequencies: Count the frequency of each letter in the cipher text.
2. Compare Frequencies: Compare these frequencies to the known letter frequencies in the
language (e.g., in English, E is the most common letter).
4. Refine Substitutions: Refine the substitutions by looking for common words and patterns in the
language.
Example:
Ciphertext: ITSSG
Refine the guess by analyzing the resulting partially decrypted text and looking for common
words.
In practice, frequency analysis requires some trial and error and a good understanding of the language's
letter frequ