Lecture 2a
Lecture 2a
Introduction to Cryptography
And Monoalphabetic Ciphers
1
2
.. Prehistory
• Cryptography was used..
– For military purposes
• In ancient time
– For private business
• Religious affairs, secret trades, illegal activities
– To protect privacy of individuals
• Caesar
Kerckhoff’s Principle
• Given by Auguste Kerckhoffs in 19th Century
for military ciphers.
• “a crptosystem should be secure even if
everything about the system, except the key, is
public knowledge”
• Security should rely on the secrecy of the key
only and not on the security of the algorithm.
Secrecy Vs Privacy
• Confidentiality (secrecy)
– Insurance that a given information cannot be
accessed by unauthorized parties.
• Privacy ≠ secrecy
– Ability for a person to control how his personal
information spreads in a community
Classical
Cryptosystems
(Monoalphabetic)
Cryptosystem
A cryptosystem is a five-tuple (P, C, K, E, D), where following
conditions are satisfied :
1. P is a finite set of possible plaintexts
2. C is a finite set of possible ciphertexts
3. K, the keyspace, is a finite set of possible keys
4. For each K K, there is an encryption algorithm EK E and
a corresponding decryption algorithm DK D. Each EK : P
C and DK : C P are functions such that DK(EK(X)) = X for
every plaintext X P.
Simple Cryptosystems
Monoalphabetic Ciphers
22 4 22 8 11 11 12 4 4 19 0 19 12 8 3 13 8 6 7 19
Let K=11, we add 11 to each value, reducing each sum modulo 26, we get ciphertext
7 15 7 19 22 22 23 15 15 4 11 4 23 19 14 24 19 17 18 4
H P T T W W X P P E L E X T O Y T R S E
1. Shift Cipher
For a particular Key k=3, the cryptosystem is often called the
Caesar Cipher (Roman Empire, 2000 years ago )
0123456...
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC
3456789...
Example:
Plaintex: s u b s t i t u t i o n
Ciphertext:V U N V M Z M U M Z F S
2. Cryptanalysis of The
Substitution Cipher
• This is particularly true for long messages (i.e., the longer the
text, the closer the letter frequency distributions match the
language’s letter frequency distributions)
Letter A B C D E F G H I J K L M
Frequency 7.4 1.0 3.1 4.2 13.0 2.8 1.6 3.4 7.4 0.2 0.3 3.6 2.5
Letter N O P Q R S T U V W X Y Z
Frequency 7.9 8.0 2.7 0.3 8.0 6.1 9.2 2.6 1.5 1.6 0.5 1.9 0.1
English language:
Relative letter frequencies
• Ciphertext:
R jrk hbxiu lk vai vzihova ohlls lo rk rmrsvjikv
ywbhtbkn. Ixise jlskbkn ai vrgiu vai ihixrvls tlzk
vl vai hlyye rkt hirxiu vai ywbhtbkn. Bk vai
ixikbkn, ai nivu bkvl vai ihixrvls, rkt, bo vaisi
bu uljilki ihui bk vai ihixrvls -- ls bo bv zru
srbkbkn varv tre -- ai nliu yrpg vl abu ohlls
tbsipvhe. Alzixis, bo vaisi bu klylte ihui bk vai
ihixrvls rkt bv aruk'v srbkit, ai nliu vl vai vikva
ohlls rkt zrhgu wm vzl ohbnavu lo uvrbsu vl abu
sllj.
• Letter frequency count (total = 344 letters):
Letter A B C D E F G H I J K L M
Frequency 23 26 0 0 5 0 3 18 49 5 26 32 2
Letter N O P Q R S T U V W X Y Z
Frequency 9 10 2 0 24 19 11 19 37 3 9 6 6
Relative frequency distributions
(English & ciphertext)
Example: Frequency analysis
• From the frequency distributions, we assume that:
– The ciphertext letter I corresponds to the plaintext letter E (the most
frequent letter in the English language)
– The ciphertext letter V corresponds to the plaintext letter T (the second
most frequent letter in the English language)
• Trigram frequencies
– Common trigrams: THE, ING, THA, ENT
Suppose K=(7,3), We can calculate 7-1 mod 26=15, the encryption formula becomes:
eK (x)=7*x + 3 mod 26
And the corresponding decryption function id
dk(y)= 15 (y-3) = 15 y - 19
Example: Encrypt “ hot” 7, 14, 19
(7 x 7 + 3) mod 26 = 52 mod 26 = 0
7x14 + 3) mod 26 =101 mod 26=23
(7x19 + 3) mod 26 -= 136 mod 26=6 0,23,6 AXG
Home work
• Groups, Rings and Fields
• Modular Arithmetic
• Finite Fields (2n)
• Multiplicative Inverse