Substitution Cipher
Introduction
Each character in the plaintext is substituted by another character in the ciphertext.
Types of Substitution Cipher
Simple Substitution Cipher
This is also known as Monoalphabetic Cipher.
Each character of the plaintext is mapped to a corresponding character of ciphertext.
Homophonic Substitution Cipher
A single character of plaintext can be mapped to one or more characters of ciphertext.
Polygram / Polygraphic Substitution Cipher
Blocks of characters are encrypted in groups.
Polyalphabetic Substitution Cipher
This is made up of multiple simple substitution ciphers.
Shift Cipher (Caesar Cipher)
The 26 letters are mapped from 0 to 25.
- The key space is .
- chooses uniformly.
- outputs , where
- outputs , where
Vigenere Cipher
The 26 letters are mapped from 0 to 25.
The secret key is a string, and denotes the length of .
The ciphertext is generated by:
A Vigenere Square can be used to encrypt and decrypt conveniently.
Where is the intersection character of and
Transposition Ciphers
The plaintext remains the same, and oly the order of characters is shuffled around.
Rail Fence Cipher
The secret key is an integer, called rails.
Suppose to encrypt the message “HELLO_WORLD”, if , then
H L O W R D
E L _ O LThe ciphertext is “HLOWRDEL_OL”.
If , then
H O R
E L _ O L
L W DThe ciphertext is “HOREL_OLLWD”.
Simple Columnar Transposition
The plaintext is written horizontally into a table, and the ciphertext is read off vertically.
The secret key is a string.
Suppose the key is “SECRET”, and the plaintext is “HELLO WORLD”, the table will be:
| S (5) | E (2) | C (1) | R (4) | E (3) | T (6) |
|---|---|---|---|---|---|
| H | E | L | L | O | W |
| O | R | L | D |
Then read vertically according to the order of letters in the secret key. The ciphertext will be “LLEROLDHOW”.