Lecture 1 Classical Cryptography
Lecture 1 Classical Cryptography
Computer Security
Classical cryptology
Outline
What is cryptology?
– Cryptography.
– Cryptanalysis.
Communication model.
Secret-key cryptography.
Epochs.
Early ciphers:
– Caesar.
– Monoalphabetic.
Statistical cryptanalysis.
Cryptology
From the Greek words:
– kryptos meaning “hidden”
– logos meaning “word”
Cryptology is the art/science of secure communication. It
splits into…
Security Security
Transformation Transformation
Information Channel
Message Message
Sender Receiver
Alice Bob
Key Key
Opponent
Oscar
The basic secrecy channel
The channel can be a communication channel or a storage
channel.
Symmetric
Plaintext Ciphertext Plaintext
E D
Asymmetric
Plaintext Ciphertext Plaintext
E D
Kirchoff’s Law
a b a d d a y
F G F T T F P
Example: Consider the plaintext and
ciphertext alphabets to be the set of binary
strings of length 3.
a b c d e … x y z
F G N G A … K P L
a b a d d a y
F G F G G F P
c o m p u t e r
C O M P U T E R
In most ciphers there are some weak keys.
Properties of keys
Keys must be easy to remember, a long random string is
difficult to remember.
Frequent trigrams:
the, ing, and, her, ere, ent
tha, nth, was, eth, for, dth
50
40
Frequency
30
20
10
0
Ciphertext letters
There are 8 JCZ in the ciphertext, this is
almost certainly the in the plaintext.
The single letters will generally be i or a.
In this case there is a single letter word V
in the ciphertext.
The word JZB in the ciphertext can be
identified by looking at the word teB and
noting that B occurs in the second
frequency group for this ciphertext.
– Some of those letters (t a o i n s h r) have
already been identified.
After a few of these kind of steps we can
build up a preliminary mapping such as:
a b c d e f g h i
V Z C L
j k l m n o p q r
B D H
s t u v w x y z
I J
V W X Y Z R A C L
j k l m n o p q r
O M S E B D F G H
s t u V w x Y z
I J K N P Q T U
YKHLBA JCZ SVIJ JZB TZVHI JCZ VHJ DR IZXKHLBA VSS
RDHEI DR YVJV LBXSKYLBA YLALJVS IFZZXC CVI
LEFHDNZY EVBLRDSY JCZ FHLEVHT HZVIDB RDH JCLI
CVI WZZB JCZ VYNZBJ DR ELXHDZSZXJHDBLXI JCZ
XDEFSZQLJT DR JCZ RKBXJLDBI JCVJ XVB BDP WZ
FZHRDHEZY WT JCZ EVXCLBZ CVI HLIZB
YHVEVJLXVSST VI V HZIKSJ DR JCLI HZXZBJ
YZNZSDFEZBJ LB JZXCBDSDAT EVBT DR JCZ XLFCZH
ITIJZEI JCVJ PZHZ DBXZ XDBILYZHZY IZXKHZ VHZ BDP
WHZVMVWSZ.
50
40
Frequency
30
20
10
0
Ciphertext letters
Flattening the histogram
a b c d
S2
D B C A a b c d
Histogram
X a b a c a d a d c
Z 1 2 2 1 2 1 2 2 2
Y B B D A D C D A C
f
a b c d
Histogram
A B C D A B C D A B C D
Substitution 1 Substitution 2 Substitution 1 + Substitution 2
Polyalphabetic ciphers
A ciphertext character represents more than
one plaintext character. This must be done
in a way that allows the plaintext to be
recovered.
– For example, if B represents n and t we need to
know when to decipher it as n, and when as t.
A polyalphabetic cipher uses a sequence of
substitution alphabets. If this sequence
repeats after p characters, we say it has
period p.
The Vigenère cipher
f ( f 1)
IC ( x) A
n(n 1)
IC(x) is an estimate of the probability that
two randomly chosen elements of X are
identical.
It is also a measure of roughness of the
histogram, that is, it indicates how uneven
the histogram is.
The Index of Coincidence can be used to
estimate the period (Friedman or Kappa
test).
0.027 n
IC (n 1) 0.038n 0.065
Random IC and English IC
If X were a random string over the English alphabet we would
expect the probability of each letter occurring to be the same,
so that
IC 1/26 0.038
If X is an English language text then we would expect, for p()
the probability of a particular letter being ,
Z
IC ( x) p ( ) 0.065
2
A
The two values 0.065 and 0.038 are sufficiently far apart that
we will often be able to determine the correct keyword length.
English language letter probabilities
A B C D E F G H I
0.082 0.015 0.028 0.043 0.127 0.022 0.020 0.061 0.070
J K L M N O P Q R
0.002 0.008 0.040 0.024 0.067 0.075 0.019 0.001 0.060
S T U V W X Y Z
0.063 0.091 0.028 0.010 0.023 0.001 0.020 0.001
IC for monoalphabetic ciphers
oo yo sejg z fsec k lw dtudw jrlw sej ws f lplcld pzv or g adwg y vqzs zgd
frsg p j hp sc agsdgo pmotf sej wsf ij av qd fyw t cxgtfz tudtw wnmwr gs
tw o asan zoe jzev fqkwy lo lw bbw c fq s c sg ew ork iojfoss plf tz v hvg
cfs q julk b hlw zj sw xfp uzpw t ck b dabp oh ew flwh zwhl l cqj rqfb
fvfcvop vqeg glfb ew ilawd zcr ls zaz nwqd g v aqwl sr tdund qpug sl g
yaopq wvv c s shg ybclc z fk yosr sr y ...
Component 1: IC = .047082
Component 2: IC = .050946
p=2 .047028 .050946