Professional Documents
Culture Documents
Chapter 2 - Cryptography - Part I
Chapter 2 - Cryptography - Part I
Chapter 2 - Cryptography - Part I
Activity
What is cryptography ?
Introduction
Cryptography is the study of Encryption
◦ Greek kryptos means “hidden” and
graphia means “writtings”
Encryption is an ancient form of
information protection. … dates back
4,000 years.
◦ process by which plaintext is converted into
ciphertext.
Decryption is the inverse of Encryption.
Introduction …
A sender S wanting to transmit message M to
a receiver R
To protect the message M, the sender first
encrypts it into meaningless message M’
After receipt of M’, R decrypts the message to
obtain M
M is called the plaintext
◦ What we want to encrypt
M’ is called the ciphertext
◦ The encrypted output
Introduction…
Notation
Given
P=Plaintext
C=CipherText
C = EK (P) Encryption
P = DK ( C) Decryption
Terminologies
cusetyri
tfdvsjuz 19 5 3 21 18 9 20 25
Simple Simple Substitution
Transposition
Classical Substitution
Caesar Cipher: used by Julius Caesar's
◦ substitutes each letter of the alphabet with
the letter standing three places further down
the alphabet
Caesar cipher
Activity
Plaintext a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext DE F G H I J K L M N O P Q R S T U V WX Y Z A B C
Caesar Cipher
the algorithm can be expressed as, for each
plaintext letter P, substitute ciphertext
letter C.
◦ C = E(3, p) = (p + 3) mod 26
mathematically give each letter a number
abcde fg hi j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
General Caesar algorithm as:
c = E(k, p) = (p + k) mod (26)
p = D(k, c) = (c – k) mod (26)
Where k is [1 to 25]. Secret-key
Monoalphabetic Cipher
ratherthan just shifting the alphabet
could shuffle the letters arbitrarily
each plaintext letter maps to a different
random ciphertext letter
hence key is 26 letters long
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
but would be !!!WRONG!!!
problem is language characteristics,
statistical techniques
Playfair Cipher
It is a Polyalphabetic Cipher, a substitution
cipher in which the cipher alphabet for the plain
alphabet may be different at different places
during the encryption process.
A manual symmetric encryption technique
It was the first literal digraph substitution cipher.
◦ The scheme was invented in 1854 by Charles
Wheatstone, but bears the name of Lord Playfair who
promoted the use of the cipher.
Used in WWI and WWII
Playfair Key Matrix
a 5X5 matrix of letters based on a keyword
fill in letters of keyword (no duplicates, i & j)
fill rest of matrix with other letters
eg. using the keyword (key) simple
s i/j m p l
e a b c d
f g h k n
o q r t u
v w x y z
Playfair Cipher
Use filler letter to separate repeated letters
◦ eg. "balloon" encrypts as "ba lx lo on" Encrypt two letters
together
klbfhvs
Ciphertext: b
Examples
• Let us say we want to encrypt the message “hide money”. It will
be written as −
• HI DE MO NE YZ
1. If both the letters are in the same column, take the letter below
each one (going back to the top if at the bottom)
2. If both letters are in the same row, take the letter to the right of
each one (going back to the left if at the farthest right)
plaintext:
wearediscoveredsaveyourself
Key: deceptivedeceptivedeceptive
Ciphertext:
zicvtwqngrzgvtwavzhcqyglmgj
Security of Vigenère Ciphers
have multiple ciphertext letters for each
plaintext letter
◦ hence letter frequencies are masked
◦ but not totally lost
start with letter frequencies
◦ see if look monoalphabetic or not
ifnot, then need to determine number of
alphabets, since then can attach each
Transposition Cipher
• So far we have seen ciphering with substitution.
– Order is different
Ciphering with Transposition
This is how a pure permutation cipher could work:
– Spartans cipher
– Route cipher
60
Classical Transposition
• Spartans cipher , fifth century
B.C. Start the war today
S t a
r tt
h e
wa r
t
o d
ay
Rewrit
Srhaoytterdatwta
e it by 61
readin
Rail Fence Cipher
Write the plaintext downwards on successive "rails" of an
imaginary fence. When you get to the bottom start moving
up. Write the message line by line.
W R I O R F E O E
E E S V E L A N
A D C E D E T C
The message:
WRIORFEOEEESVELANADCEDETC.
Route Cipher
The plaintext is first written out in a grid of given dimensions,
then we read it off in a pattern given in the key.
Example: The key say: read message from top right corner down and
to the left.
W D V F T
E I E L O
A S R E N
R C E E C
E O D A E
TONCEADOEFLEEECRVERSADIEW
Cryptanalytic Attacks
Types of attacks
– Cryptanalytic attack