Module 1_part_2 -Cipher Techniques(1)
Module 1_part_2 -Cipher Techniques(1)
Network Security
COMP4055
Cryptography
Module 1
Part 2
Cipher Techniques
Classical Substitution Ciphers
• A substitution cipher substitutes one piece
of information for another.
Plain: abcdefghijklmnopqrstuvwxyz
Key: DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Playfair Cipher
not even the large number of keys in a monoalphabetic cipher
provides security
one approach to improving security was to encrypt multiple letters
the Playfair Cipher is an example
invented by Charles Wheatstone in 1854, but named after his friend
Baron Playfair
Playfair Key Matrix
a 5X5 matrix of letters based on a keyword
fill in letters of keyword (without duplicates)
fill rest of matrix with other letters
eg. using the keyword MONARCHY
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Encrypting and Decrypting
Plaintext is encrypted two letters at a time
1. if a pair is a repeated letter, insert filler like 'X’
2. if both letters fall in the same row, replace each with letter
to right (wrapping back to start from end)
3. if both letters fall in the same column, replace each with
the letter below it (wrapping to top from bottom)
4. otherwise each letter is replaced by the letter in the same
row and in the column of the other letter of the pair
Security of Playfair Cipher
security much improved over monoalphabetic
since have 26 x 26 = 676 digrams
would need a 676 entry frequency table to analyse (verses 26 for a
monoalphabetic)
and correspondingly more ciphertext
was widely used for many years
eg. by US & British military in WW1
since still has much of plaintext structure
What is the size of key space in the substitution monoalphabetic
cipher assuming 26 letters?
26!
To Decrypt: R
S
S
T
T U
U V
V
W
W X
X Y
Y
Z
Z
A B
A B
C
C
D
D E
E F
F
G
G H
H I
I
J
J
K
K
L
L
M
M
N
N O
O P
P
Q
Q
R
T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U V W X Y Z A B C D E F G H I J K L M N O P Q R S T
Take a letter from the keyword, go to its row. Find the ciphertext in V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
Source: h t t p : / / p a g e s . m t u . e d u / ~ s h e n e / N S F - 4 / Tu t o r i a l / V I G / V i g - B a s e . h t m l
Encryption Operations: Vernam
Cipher
Developed at AT&T
Uses a set of characters for encryption operations only one time and then discards
it
Encryption process
Values from one-time pad added to the block of text
Resulting sum is converted to text
When the two sets of values are added, if the resulting values exceed 26
26 is subtracted from the total (called modulo 26 in Modular arithmetic)
• Decryption process
• Take the first letter of the ciphertext and the first letter of the key, and
subtract their value. If the result is negative, add 26
18
Encryption Operations: Vernam
Cipher (cont’d.)
19
Transposition Cipher
Reference:
https://www.dcode.fr/rail-fence-cipher
https://crypto.interactive-maths.com/rail-fence-cipher.html
Transposition Cipher Key
• The key determines the positions that the characters are moved to
– Instead of a list of alphabetic substitutions, it is a mapping order.
– Such as (1,2,3,4,5) = (3,4,5,2,1). This means that the third element is put in place of the first,
thus followed by the fourth, then the fifth, second, and finally followed by the original first
element.
– Key can be a word such as "WORLD“. Based on alphabet order, the key order is “53412"
Example 2: Columnar transposition
1 2 3 4 5
C 0 m P 4
4 5 1 3 2
p 4 C m 0
When the permutation is applied to all the blocks, we obtain:
Comp4 055te aches ciphe rsxxx
p4Cmo te055 esahc hecpi xxrxs
So, the ciphertext message is
Concealment Cipher
The concealment cipher hides a message in a longer message i.e. “a
message WITHIN a message”
• A paragraph is sent to you containing an embedded secret
message.
• Example:
– The agreed upon secret key is to use every sixth word.
– Selecting every sixth word in the paragraph will decrypt the message