Cryptography Assignment
Name: Lalande Jean David
Substitution Cipher
Overview
An encryption technique known as a substitution cipher substitutes a
letter with a predetermined connection for each letter in the plaintext.
This is one of the oldest and most popular encryption techniques, dating
back thousands of years.
Operational Framework
A substitution cipher maps each letter in the plaintext alphabet to an
equivalent letter in the ciphertext alphabet. The replacement rule is the
key to the encryption.
Example
Now let's look at a straightforward example with the following key:
Plaintext alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ciphertext alphabet: QWERTYUIOPASDFGHJKLZXCVBNM
If we want to encrypt the plaintext message "HELLO":
H -> I
E -> T
L -> S
O -> G
Thus the ciphertext, "HELLO" becomes ITSSG.
Security
Relatively speaking, frequency analysis makes substitution ciphers less
secure. Any language has distinctive frequency patterns for specific letters
and letter combinations. Frequently, the plaintext can be determined by
examining the ciphertext's letter frequency.
Variation of substitution cipher
Polybius Square Cipher
The Polybius Square cipher is a substitution cipher that uses a 5x5 grid
filled with letters to encrypt the plaintext. Invented by an ancient Greek
historian and scholar Polybius.
Working Principle
1. Create a 5x5 grid and fill it with the alphabet, typically combining 'I'
and 'J' to fit 25 letters.
2. Encrypt the plaintext by replacing each letter with its coordinates in
the grid.
1 2 3 4 5
1 A B C D E
2 F G H I/J K
3 L M N O P
4 Q R S T U
5 V W X Y Z
Encrypting plaintext “ HELLO”
H----23
E----15
L----31
L----31
O---34
Ciphertext: 2315313134
Caesar Cipher
Introduction
Julius Caesar is credited with creating the Caesar cipher, a kind of
substitution cipher that he allegedly used to communicate with his
officials. Among the most popular and straightforward encryption methods
is this one.
Operational Concept
Every letter in the plaintext is moved up or down in the alphabet by a
specific amount when using the Caesar cipher. The essential factor is the
shift value.
Example
Let's use a shift of 3 for our example:
Plaintext alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ciphertext alphabet: DEFGHIJKLMNOPQRSTUVWXYZABC
Encrypting “hello” using shift 3
The result become ‘KHOR’
Security
Frequency analysis can help break the Caesar encryption. It can also be
readily broken by brute force because there are only 25 potential shifts.
Variations of Caesar Cipher
Rot13
The Rot13 (rotate by 13 places) cipher is a popular variation of the Caesar
cipher. It is applied in many different contexts, such as basic obfuscation
and spoiler concealment. The original text is returned when Rot13 is
applied twice because the alphabet consists of 26 letters.
Plaintext: "HELLO"
Rot13: "URYYB"
Explanation table for Rot13
Plaintext H E L L O
:
Numeric: 7 4 11 11 14
Shift 20 17 24 24 1
+13:
Cipherte U R Y Y B
xt:
Transposition Cipher
Overview
A transposition cipher, sometimes referred to as a permutation cipher, is
an encryption technique in which the ciphertext is created by shifting the
plaintext's character locations in accordance with a predetermined
scheme. Transposition ciphers, in contrast to substitution ciphers, change
the locations of the characters in the message rather than the characters
themselves.
Rail Fence Cipher
Operational Concept
In the Rail Fence cipher, the plaintext is written in a zigzag pattern across
multiple rows and then read row by row to create the ciphertext.
1. Plain text: “Red house” using 3 rails
R O
E H U E
D S
Rail 1:RO
Rail 2: EHUE
Rail 3: DS
Ciphertext: ROEHUEDS
2. Plaintext: “The sky is blue “using 5 rails
T b Rail 1: TB
h s l
Rail 2: HSL
e i u
s y e Rail 3: EIU
k
Rail 4: SYE
Ciphertext: TBHSLEIUSYEK
Rail 5: K
Although the Rail Fence encryption makes character transposition in
messages simple and easy to understand, it is not safe enough for critical
cryptography applications. It is vulnerable to attackers due to its tiny key
space, anagramming vulnerability, and brute force assault susceptibility.
Columnar Transposition Cipher
With the use of a key that dictates the sequence in which columns are
read and a predetermined number of columns, the Columnar Transposition
cypher reorganizes the characters in the plaintext.
Operational Concept
- Select a Keyword: The columns are read in the order specified by
the keyword.
- Plaintext into a Grid: The length of each column in the plaintext grid
corresponds to the length of the keyword.
- Go through the columns sequentially: To produce the ciphertext, the
columns are read in the sequence that the keyword specifies.
For this example, let's utilize the term "KEY". Firstly, we arrange the
keyword in numerical order:
K -> 2
E -> 1
Y -> 3
So, the order will be: 2, 1, 3
Plaintext: Red House
K E
Y
R E D
H O U
S E
Based on the numerical sequence obtained from the keyword (2, 1, 3), we
will use the following columns:
Column 1 (E): E, O, E
Column 2 (K): R, H, S
Column 3 (Y): D, U,
Cipher text: EOERHSDU
Because it uses a keyword to decide the order of columns, the Columnar
Transposition cipher is a more secure transposition technique.