Lecture – 07
Introduction of Cryptography
(Encryption Basics & Classical Ciphers)
Course Instructor: Hina Alam
(hina.alam@ucp.edu.pk)
Transposition Ciphers
Agenda
Contents
1. Reverse Cipher
2. Row Transposition (Columnar Transposition)
3. Double Transposition
Reverse Cipher (aka Mirror Cipher)
The Reverse Cipher is the simplest form of a transposition cipher.
▪ All it does is reverse the order of the letters in the message
How It Works:
Encryption:
● Take the original message.
● Reverse the characters.
Decryption:
● Reverse it again.
● You get the original message back.
Write the message backwards….
Key-space: 1
Why
?
Example
Original Message: MEET ME AT MIDNIGHT
▪ Encrypted with Reverse Cipher:
We just reverse all the characters (including spaces):
THGINDIM TA EM TEEM
Transposition Ciphers:
Row Transposition Cipher
Transposition Ciphers: Row Transposition Cipher
Also known as Columnar Transposition Cipher.
• A transposition cipher used in World War I and II as a hand cipher.
• The key determines the number of columns and their order.
• Involves rearranging the letters of the plaintext in a grid based on the key.
Key Concept:
➢The plaintext is written row-wise in a grid, where the number of columns corresponds to the
length of the key.
➢Each letter in the key represents a column number, dictating the order in which the
columns will be read.
Steps for Row Transposition Cipher
1. Write the Plaintext Row-wise.
2. Reorder the Columns.
3. Read the Ciphertext Column-wise.
Key-space:
➢ The number of possible keys is determined by the number of permutations of the key.
➢ If the key length is n, the key-space is n! (factorial of n), as there are that many ways to arrange
the columns.
Example 01 -
Encryption
Example 02 -
Encryption
▪ Plaintext: attackXatXdawn
▪ Keyword: 3421567
▪ Cipher Text = ?
Key 3 4 2 1 5 6 7
a t t a c k X
Row Wise
Plain Text a t X d a w n
Cipher Text:
Rearrange
adtXaattcakwXn
Rearrange
the Key 1 2 3 4 5 6 7
a t a t c k X
Row Wise
Plain Text d X a t a w n
Example 02 -
Decryption
▪ Plaintext: ?
▪ Keyword: 3421567
▪ Cipher Text: adtXaattcakwXn
Rearrange
the Key 1 2 3 4 5 6 7
a t a t c k X
Row Wise
Plain Text d X a t a w n
Rearrange
Plaintext:
attackXatXdawn
Rearrange
3 4 2 1 5 6 7
the Key
a t t a c k X
Row Wise
Plain Text a t X d a w n
Example
▪ Plaintext: a convenient way to the permutation
▪ Keyword: COMPUTER
▪ Cipher Text = ?
What if the key is not
given?
Transposition Ciphers:
Double Transposition Cipher
Double Transposition Cipher
– Used in WW2 for secure communication.
• Key defines matrix size and permutation process.
Steps:
➢Permute the rows of the matrix.
➢Permute the columns of the matrix.
Example 01 -
Encryption
First transposition
Example 02 -
Decryption
▪ Plaintext: ?
▪ Keyword: 35142(rows) - 132(columns)
3 2
1
Permute Rows Permute
Columns
Plaintext:
attackXatXdawn