Professional Documents
Culture Documents
Classical Ciphers: by Mr. Fasee Ullah Cusit Peshawar
Classical Ciphers: by Mr. Fasee Ullah Cusit Peshawar
By
Mr. Fasee Ullah
CUSIT
Peshawar
Agenda
Types of classical ciphers
Asymmetric cryptography
Application of Asymmetric encryption
Symmetric Cipher Model
A symmetric encryption scheme has five ingredients
Plaintext: This is the original message or data
Encryption algorithm: The encryption algorithm performs
various substitutions and transformations on the plaintext
Secret key: The secret key is also input to the encryption
algorithm
The algorithm will produce a different output depending
on the specific key being used at the time
The exact substitutions and transformations performed by
the algorithm depend on the key
Contd…
Ciphertext: This is the scrambled message
produced as output
It depends on the plaintext and the secret key and,
as it stands, is unintelligible
Decryption algorithm: This is essentially the
encryption algorithm run in reverse
It takes the ciphertext and the secret key and
produces the original plaintext
Classical Substitution Ciphers
Substitution techniques use classical encryption
technique
A study of these techniques enables us to explain the
basic approaches to symmetric encryption used today
Two basic block of encryption techniques are
substitution
Transposition
A substitution technique is one in which the letters of
plaintext are replaced by other letters or by numbers or
symbols
Caesar Cipher
earliest known substitution cipher
by Julius Caesar
first attested use in military affairs
replaces each letter by 3rd letter on
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Monoalphabetic Cipher Security
now have a total of 26! = 4 x 1026 keys
with so many keys, might think is secure to
eliminate brute-force techniques
but would be !!!WRONG!!!
problem is language characteristics
Language Redundancy and Cryptanalysis
M 6.67
Example Cryptanalysis
given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
count relative letter frequencies
guess P & Z are e and t
guess ZW is th and hence ZWP is the
proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
direct contacts have been made with political
representatives of the viet cong in moscow
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
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
wrap from right side back to left, or from bottom back to
top.
1. if a pair is a repeated letter, insert a filler like 'X', eg.
"balloon" encrypts as "ba lx lo on"
2. if both letters fall in the same row, replace each with letter
to right eg. “ar" encrypts as "RM"
3. if both letters fall in the same column, replace each with
the letter below it (again wrapping to top from bottom), eg.
“mu" encrypts to "CM"
4. otherwise each letter is replaced by the one in its row in the
column of the other letter of the pair, eg. “hs" encrypts to
"BP", and “ea" to "IM" or "JM" (as desired)
Security of Playfair Cipher
security much improved over monoalphabetic
since have 26 x 26 = 676 digrams
was widely used for many years
eg. by US & British military in WW1
Polyalphabetic Ciphers
polyalphabetic substitution ciphers
improve security using multiple cipher
alphabets
make cryptanalysis harder with more
alphabets to guess
use a key to select which alphabet is used for
plaintext
can only use the key once though
The one-time pad offers complete security but, in practice, has two
fundamental difficulties:
1. There is the practical problem of making large quantities of random keys
2. And the problem of key distribution and protection, where for every
message to be sent, a key of equal length is needed by both sender and
receiver
Transposition Ciphers
now consider classical transposition or
permutation ciphers
these hide the message by rearranging the letter
order
without altering the actual letters used
Rail Fence cipher
write message letters out diagonally over a number of
rows
then read off cipher row by row
eg. write message out as:
m e m a t r h t g p r y
e t e f e t e o a a t
giving ciphertext
MEMATRHTGPRYETEFETEOAAT
Row Transposition Ciphers
a more complex transposition
write letters of message out in rows over a
specified number of columns
then reorder the columns according to some key
before reading off the rows
Key: 3421567
Plaintext: a t t a c k p
ostpone
duntilt
woamxyz
Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ
Product Ciphers
ciphers using substitutions or transpositions are not
secure because of language characteristics
hence consider using several ciphers in succession to
make harder, but:
two substitutions make a more complex substitution
two transpositions make more complex transposition
but a substitution followed by a transposition makes a new
much harder cipher
this is bridge from classical to modern ciphers
Rotor Machines
before modern ciphers, rotor machines were most
common complex ciphers in use
widely used in WW2
German Enigma, Allied Hagelin, Japanese Purple
implemented a very complex, varying
substitution cipher
used a series of cylinders, each giving one