Classic Cryptography
Classic Cryptography
Classic Cryptography
Classic Crypto
Overview
Transposition ciphers
Substitution ciphers
One-time pad
Codebook
Classic Crypto
Transposition Ciphers
Classic Crypto
Scytale
Spartans, circa 500 BC
Wind strip of leather around a rod
Write message across the rod
T H E T I M E H A
S C O M E T H E W
A L R U S S A I D
T O T A L K O F M
A N Y T H I N G S
When unwrapped, letters are scrambled
TSATAHCLONEORTYTMUATIESLHMTS
Classic Crypto
Scytale
Classic Crypto
Columnar Transposition
Put plaintext into rows of matrix then read
ciphertext out of columns
For example, suppose matrix is 3 x 4
o Plaintext: SEETHELIGHT
o Ciphertext: SHGEEHELTTIX
Classic Crypto
Keyword Columnar
Transposition
For example
o Plaintext: CRYPTOISFUN
o Matrix 3 x 4 and keyword MATH
o Ciphertext: ROUPSXCTFYIN
Classic Crypto
Keyword Columnar
Transposition
How can Trudy cryptanalyze this cipher?
Consider the ciphertext
Classic Crypto
Keyword Columnar
Transposition
The ciphertext is
Classic Crypto
Cryptanalysis: Lesson I
Classic Crypto
Double Transposition
Plaintext:
columns
row 0
0
A
1
T
2
T
row 1
row 2
row 3
row 4
ATTACK AT DAWN
Ciphertext:
Key?
Permute rows
and columns
columns
row 2
0
X
2
T
1
A
row 4
row 0
row 3
row 1
XTAWXNATTXADAKC
Classic Crypto
Double Transposition
How can Trudy attack double transposition?
Spse Trudy sees 45-letter ciphertext
Then how many keys?
Classic Crypto
Double Transposition
Classic Crypto
column
row 0
row 1
row 2
row 3
row 4
row 5
row 6
row 7
row 8
0
I
E
O
A
V
E
V
S
N
1
L
A
M
N
E
R
E
T
N
2
I
H
E
N
G
W
M
T
T
3
L
R
E
D
M
E
T
A
N
4
W
E
S
D
I
H
O
O
H
Double Transposition
Shortcut attack on double transposition?
Trudy tries columns first strategy
column
row 0
row 1
row 2
row 3
row 4
row 5
row 6
row 7
row 8
0
I
E
O
A
V
E
V
S
N
1
L
A
M
N
E
R
E
T
N
2
I
H
E
N
G
W
M
T
T
3
L
R
E
D
M
E
T
A
N
Now what?
Classic Crypto
4
W
E
S
D
I
H
O
O
H
Permute
columns
column
row 0
row 1
row 2
row 3
row 4
row 5
row 6
row 7
row 8
2
I
H
E
N
G
W
M
T
T
4
W
E
S
D
I
H
O
O
H
0
I
E
O
A
V
E
V
S
N
1
L
A
M
N
E
R
E
T
N
3
L
R
E
D
M
E
T
A
N
Cryptanalysis: Lesson II
Classic Crypto
Substitution Ciphers
Classic Crypto
Ceasars Cipher
Plaintext:
FOURSCOREANDSEVENYEARSAGO
Key:
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 D E F G H I J K L M N O P Q R S T U V WX Y Z A B C
Ciphertext:
IRXUVFRUHDAGVHYHABHDUVDIR
More succinctly, key is shift by 3
Classic Crypto
Ceasars Cipher
Trudy
Then
plaintext is
SPONGEBOBSQUAREPANTS
Classic Crypto
Simple Substitution
Caesars
Classic Crypto
Simple Substitution
Key
Then
Cryptanalysis of Simple
Substitution
Trudy know a simple substitution is used
Can she find the key given ciphertext:
PBFPVYFBQXZTYFPBFEQJHDXXQVAPTPQJKTOYQWIPBVW
LXTOXBTFXQWAXBVCXQWAXFQJVWLEQNTOZQGGQLFXQ
WAKVWLXQWAEBIPBFXFQVXGTVJVWLBTPQWAEBFPBFH
CVLXBQUFEVWLXGDPEQVPQGVPPBFTIXPFHXZHVFAGF
OTHFEFBQUFTDHZBQPOTHXTYFTODXQHFTDPTOGHFQP
BQWAQJJTODXQHFOQPWTBDHHIXQVAPBFZQHCFWPFHP
BFIPBQWKFABVYYDZBOTHPBQPQJTQOTOGHFQAPBFEQ
JHDXXQVAVXEBQPEFZBVFOJIWFFACFCCFHQWAUVWFL
QHGFXVAFXQHFUFHILTTAVWAFFAWTEVOITDHFHFQAI
TIXPFHXAFQHEFZQWGFLVWPTOFFA
Classic Crypto
Cryptanalysis of Simple
Substitution
Trudy cannot try all 288 possible keys
Can she be more clever?
Statistics!
English letter frequency counts:
0.14
0.12
0.10
0.08
0.06
0.04
0.02
0.00
A B C D E F G H I
Classic Crypto
J K
L M N O P Q R S T U V W X Y Z
Cryptanalysis of Simple
Substitution
Ciphertext:
PBFPVYFBQXZTYFPBFEQJHDXXQVAPTPQJKTOYQWIPBVWLXTOXBTF
XQWAXBVCXQWAXFQJVWLEQNTOZQGGQLFXQWAKVWLXQWAEBIPBF
XFQVXGTVJVWLBTPQWAEBFPBFHCVLXBQUFEVWLXGDPEQVPQGVP
PBFTIXPFHXZHVFAGFOTHFEFBQUFTDHZBQPOTHXTYFTODXQHFT
DPTOGHFQPBQWAQJJTODXQHFOQPWTBDHHIXQVAPBFZQHCFWPFH
PBFIPBQWKFABVYYDZBOTHPBQPQJTQOTOGHFQAPBFEQJHDXXQV
AVXEBQPEFZBVFOJIWFFACFCCFHQWAUVWFLQHGFXVAFXQHFUFH
ILTTAVWAFFAWTEVOITDHFHFQAITIXPFHXAFQHEFZQWGFLVWPT
OFFA
A B C D E F G H I J K L M N O P Q R S T U V WX Y Z
21 26 6
10 12 51 10 25 10 9
Classic Crypto
10 0
15 28 42 0
27 4
24 22 28 6
analysis
Ciphertext
Cryptographers
Classic Crypto
Poly-Alphabetic Substitution
Like
Very
Used
Classic Crypto
Affine Cipher
Number
o A is 0, B is 1, C is 2, etc.
Then
Classic Crypto
Affine Cipher
Encryption:
Classic Crypto
Vigenere Cipher
Encryption
ci = pi + ki (mod n) (mod 26)
Decryption
pi = ci ki (mod n) (mod 26)
Nothing tricky here!
Just a repeating sequence of (shift by n)
simple substitutions
Classic Crypto
Vigenere Cipher
Plaintext:
Ciphertext:
Encrypt:
S
18
+12
4
E
SECRETMESSAGE
EEVYQTFLESTNQ
E C R E T M E S S A G E
4 2 17 4 19 12 4 18 18 0 6 4
0 19 7 12 0 19 7 12 0 19 7 12
4 21 24 16 19 5 11 4 18 19 13 16 (mod 26)
E V Y Q T F L E S T N Q
Classic Crypto
Vigenere Cipher
Vigenere
But
Index of Coincidence
Assume
What
Classic Crypto
Index of Coincidence
Gives the probability that 2 randomly
selected letters are the same
For plain English, prob. 2 letter are same:
Classic Crypto
Index of Coincidence
How to use this to estimate length of
keyword in Vigenere cipher?
Suppose keyword is length k, message is
length n
Classic Crypto
Index of Coincidence
Suppose k columns and n/k rows
Approximate number of matching pairs from
same column, but 2 different rows:
Classic Crypto
Index of Coincidence
Classic Crypto
Index of Coincidence:
Bottom Line
A
Useful
Classic Crypto
Hill Cipher
Hill cipher is not related to small mountains
Invented by Lester Hill in 1929
Classic Crypto
Hill Cipher
Plaintext, p0, p1, p2,
Each pi is block of n consecutive letters
o As a column vector
o ci = A pi (mod 26)
o Decryption: pi = A1ci (mod 26)
Classic Crypto
And
Ciphertext:
(4,22,23,9,4,22,24,19,10,25) =
EWXJEWYTKZ
Classic Crypto
Classic Crypto
Cryptanalysis: Lesson IV
Linear
Strong
Cryptanalyst
try to approximate
nonlinear parts with linear equations
Classic Crypto
One-time Pad
A
Classic Crypto
h=001
i=010
k=011
l=100
r=101
s=110
t=111
Plaintext: 001 000 010 100 001 010 111 100 000 101
Key: 111 101 110 101 111 100 000 101 110 000
Ciphertext: 110 101 100 001 110 110 111 001 110 101
s
Classic Crypto
h=001
i=010
k=011
l=100
r=101
s=110
t=111
Ciphertext: 110 101 100 001 110 110 111 001 110 101
Key: 111 101 110 101 111 100 000 101 110 000
Plaintext: 001 000 010 100 001 010 111 100 000 101
h
Classic Crypto
One-time Pad
Double agent claims sender used key:
s
Ciphertext: 110 101 100 001 110 110 111 001 110 101
key: 101 111 000 101 111 100 000 101 110 000
Plaintext: 011 010 100 100 001 010 111 100 000 101
k
e=000
h=001
i
i=010
Classic Crypto
k=011
l=100
t
r=101
s=110
r
t=111
One-time Pad
Sender is captured and claims the key is:
s
Ciphertext: 110 101 100 001 110 110 111 001 110 101
Key: 111 101 000 011 101 110 001 011 101 101
Plaintext: 001 000 100 010 011 000 110 010 011 000
h
e=000
h=001
e
i=010
Classic Crypto
k=011
l=100
s
r=101
s=110
e
t=111
Classic Crypto
Project VENONA
Classic Crypto
Classic Crypto
Codebook Cipher
Literally,
Key
Codebook Cipher
Literally, a book filled with codewords
Zimmerman Telegram encrypted via codebook
Februar
fest
finanzielle
folgender
Frieden
Friedenschluss
:
13605
13732
13850
13918
17142
17149
:
Classic Crypto
Zimmerman
Telegram
One of most
famous codebook
ciphers ever
Led to US entry
in WWI
Ciphertext
shown here
Classic Crypto
Zimmerman
Telegram
Decrypted
British had
recovered
partial
codebook
Able to fill in
missing parts
Classic Crypto
Codebook Cipher
Codebooks
are susceptible to
statistical analysis
Historically,
Classic Crypto
Codebook Additive
Codebook
plaintext
lookup in
codebook
Classic Crypto
codeword
add the
additive
ciphertext
Codebook Additive
Usually,
Why
Classic Crypto
Cryptanalysis: Summary
Exhaustive
key search
Divide and conquer
Statistical analysis
Exploit linearity
Or any combination thereof (or anything
else you can think of)
Alls fair in love and war
o and cryptanalysis!
Classic Crypto