Lecture 3-4 Symmetric Cryptography
Lecture 3-4 Symmetric Cryptography
Lecturer
School of Computing
Symmetric
Cryptography
• Confidentiality
- Preventing Eve from reading Alice’s
messages
• Integrity
• Authenticity
• Symmetric Cryptography:
- Uses the same key for both encryption and decryption
- Only sender and receiver knows the key
• Asymmetric Cryptography:
- Uses different keys for encryption and decryption
- One key is public, while the other is private
Symmetric Cryptography
Pros
• Very fast to compute
• Hardware acceleration available in many cases
Cons
• No mechanism of sharing the key secretly
• Managing separate keys for each pair of users,
otherwise impersonation is possible
– If Alice and Bob share a key. Imagine Trudy shares the
same key with Alice for secure communication. Trudy
may act as Alice and talk to Bob.
Symmetric Encryption
Pros
• Very fast to compute
• Hardware acceleration available in many cases
Cons
• No mechanism of sharing the key secretly
• Managing separate keys for each pair of users,
otherwise impersonation is possible
– If Alice and Bob share a key. Imagine Trudy shares the same
key with Alice for secure communication. Trudy may act as
Alice and talk to Bob.
Classical Ciphers
When key=13,
cipher is called
ROT-13
Attacking the Ceaser cipher
ciphertext
PHHW PH DIWHU WKH WRJD SDUWB
KEY
1 oggv og chvgt vjg vqic rctva 14 btti bt puitg iwt idvp epgin
2 nffu nf bgufs uif uphb qbsuz 15 assh as othsf hvs hcuo dofhm
3 meet me after the toga party 16 zrrg zr nsgre gur gbtn cnegl
4 ldds ld zesdq sgd snfz ozqsx 17 yqqf yq mrfqd ftq fasm bmdfk
5 kccr kc ydrcp rfc rmey nyprw 18 xppe xp lqepc esp ezrl alcej
6 jbbq jb xcqbo qeb qldx mxoqv 19 wood wo kpdob dro dyqk zkbdi
7 iaap ia wbpan pda pkcw lwnpu 20 vnnc vn jocna cqn cxpj yjach
8 hzzo hz vaozm ocz ojbv kvmot 21 ummb um inbmz bpm bwoi xizbg
9 gyyn gy uznyl nby niau julns 22 tlla tl hmaly aol avnh whyaf
10 fxxm fx tymxk max mhzt itkmr 23 skkz sk glzkx znk zumg vgxze
11 ewwl ew sxlwj lzw lgys hsjlq 24 rjjy rj fkyjw ymj ytlf ufwyd
12 dvvk dv rwkvi kyv kfxr grikp 25 qiix qi ejxiv xli xske tevxc
13 cuuj cu qvjuh jxu jewq fqhjo
Brute forcing in general
Question
What is the size of ‘key space’ in the monoalphabetic
substitution cipher assuming 26 letters?
a. 26
b. 26!
c. 226
d. 262 Key space = set of all possible
keys
Cryptanalysis
Frequency Analysis
• Compute frequencies of letters in ciphertext
and compare with the typical frequencies in
the target language.
– e.g. in English texts, most frequent letters are
E (13%), T (9.1%), A (8.2%), O (7.5%)
Plaintext
(English)
Ciphertext
Cryptanalysis Techniques
B 3 🡺 E NC 11 🡺 IN UK 6 🡺 THE
6 PU 10 🡺 AT B
N 3 🡺 T UB 10 RV 6
4 N
🡺 A UN 9 Tri-gram
U 3 FZI 4
3 Di-gram s
s
P 3
2
Hardening the Substitution Cipher
Vigenère Cipher
• A key defines the shifts used in each letter in
the text
• The key word is repeated many times to
match the length of plaintext
Keyword = “BOX”
which translates to Ceaser shifts of “1, 14,
23”
plaintext I a t t a c k y o u
key 1 14 23 1 14 23 1 14 23 1
ciphertext J o q u o z l m l v
Cryptanalysis of Vigenère cipher
•
Cryptanalysis of Vigenère cipher
ciphertext J o q u o z l m l v
Section 1 J u l v
Section 2 o o m
Section 3 q z l
Cryptanalysis of Vigenère cipher
EF 3 12 9 3, 3
Cryptanalysis of Vigenère cipher
EF 3 12 9 3, 3
•
One-Time Pad (OTP)
https://www.cryptomuseum.com/crypto/otp/index.htm
One-Time Pad (OTP)
How?
• It produces random output that bears no
statistical relationship to the plaintext.
• Ciphertext contains no information whatsoever
about the plaintext
OTP Practical or not?
OTP implementation rules are very strict. If any one of these rules is
violated, we no longer have the guarantee of unbreakability.
1. The OTP should consist of truly random characters (noise).
2. The OTP (i.e. the key) should have the same length as the plaintext (or
longer).
3. Only two copies of the OTP should exist.
4. The OTP should be used only once.
5. Both copies of the OTP are destroyed immediately after use.
m m t h r
e t e f e t e a t
e a r p y
• The encrypted message is
Question
• Are permutation ciphers susceptible to
frequency analysis?
Security of Permutation Ciphers