Cryptographic Algorithms
Cryptographic Algorithms
Figure-1
-2
Requirements
• Two requirements for secure use of symmetric
encryption:
– a strong encryption algorithm
– a secret key known only to sender / receiver
• Mathematically have:
Y = EK(X)=E( K, X)
X = DK(Y)=D( K, Y)
• Assume encryption algorithm is known
• Implies a secure channel to distribute key
Type of Ciphers
• Transformation: Replace, Reverse, Case Transform, Numeral
System, Bitwise Operation
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
• but would be !!!WRONG!!!
• problem is language characteristics
Language Redundancy and Cryptanalysis
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
PlayFair Cipher: Encrypting and Decrypting
Plaintext is encrypted two letters at a time, according to the
rules as shown..
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 (wrapping back to start from end), 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)
Decrypting works exactly in reverse.
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
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
• it can be broken
One-Time Pad
• if a truly random key as long as the message is used,
then cipher will be secure, called a One-Time pad
DECRYPTION
CT L E U G V O Z X A
11 4 20 6 21 14 25 23 0
Key C K M N Z O P K A
2 10 12 13 25 14 15 10 0
TOTAL=CT-KEY 9 -6 8 -7 -4 0 10 13 0
TOTAL%26 9 20 8 19 22 0 10 13 0
CT J U I T W A K N A
Polyalphabetic Ciphers
Polyalphabetic substitution ciphers
• write the plaintext out
• write the keyword repeated above it
• use each key letter as a caesar cipher key
• encrypt the corresponding plaintext letter
• eg using keyword deceptive
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Autokey Cipher
• If the key is not as long as message, then staring from
the plaintext it acts in key
• eg. given key deceptive
key:
deceptivewearediscoveredsav
plaintext: wearediscoveredsaveyourself
ciphertext: Z ICV TWQNGKZE I IGASXSTSLVVWLA
Transposition Ciphers
• Transposition ciphers or permutation ciphers
hide the message by rearranging the letter
order
• without altering the actual letters used
• The core idea is to rearrange the order of
basic units (letters/bytes/bits) without altering
their actual values.
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: 4 3 1 2 5 6 7
Plaintext: a t t a c k p
o s t p o n e
d u n t i l t
w o a m x y z
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