Professional Documents
Culture Documents
1 0 Lect1-classicalCiphers-5
1 0 Lect1-classicalCiphers-5
Dr Bobby Yang
1/27
Course text and reference
• Textbook: Understanding
Cryptography – A textbook for
Students and Practitioners, by
Christof Paar & Jan Pelzl
• Unless otherwise stated, all
diagrams in the slides in this
course are taken from the above
textbook.
• References:
Cryptography and Network
Security – Principles and
Practice, by William Stallings
Course manual
2/27
Basic terminology
3/27
Information security challenges
4/27
Security Requirements – CIA & RAF
5/27
Confidentiality – Encryption/Decryption
6/27
Kerckhoffs’s principle
• A cryptosystem should be secure even if everything about
the system, except the key, is public knowledge. – Auguste
Kerckhoffs, 1883.
• Design principles for a cipher system:
• The system must be practically, if not mathematically,
indecipherable;
• It should not require secrecy, and it should not be a problem
if it falls into enemy hands;
• It must be possible to communicate and remember the key
without using written notes, and correspondents must be
able to change or modify it at will;
• It must be applicable to telegraph communications;
• It must be portable, and should not require several persons
to handle or operate;
• Lastly, given the circumstances in which it is to be used, the
system must be easy to use and should not be stressful to
use or require its users to know and comply with a long list
of rules.
7/27
Classical Ciphers
• Substitution ciphers
• Caesar cipher
• Vigenere table
• German Enigma
machine
• Transposition ciphter
• Scytale of Sparta
• Rail fence cipher
8/27
Substitution cipher example – Caesar’s
cipher
9/27
Mono-alphabetic Substitution cipher -
Caesar’s method
11/27
Mono-alphabetic random substitution
cipher
12/27
Random substitution cipher example
• Key
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
k d w p q m s f o c g t e i l a j u z n r y v b h x
• Plaintext:
• Ciphertext:
13/27
Poly-alphabetic cipher
14/27
Vigenère Cipher
16/27
Vigenère cipher example
• Plaintext P = ATTACKATDAWN, can be written as
(0 19 19 0 2 10 0 19 3 14 22 13).
• Key, Ks = CIPHER, written as (2 8 15 7 4 17), m = 6
(length of Ks ),.
• Split the plaintext into two blocks of 6 characters, then do
addition with the key (mod 26)
P 0 19 19 0 2 10 0 19 3 14 22 13
Ks 2 8 15 7 4 17 2 8 15 7 4 17
C 2 1 8 7 6 1 2 1 18 21 0 4
• The corresponding ciphertext is thus
C = CBIHGBCBSVAE
• Decryption using the same modulo 26 subtraction with Ks
The original plaintext is recovered.
17/27
Autokey Vigenère cipher
• Problem: If plaintext is much longer than the key?
• Naive solution: Use the key repeatedly.
• Vulnerability: identical characters in the plaintext can
appear as identical characters in the ciphertext
• Frequency analysis can be used to break the cipher.
• Autokey Vigenere cipher:
• The shared key is Ks , and plaintext is x . The actual
encryption key is hKs k x i, i.e. the plantext is appended to
the shared key and used as the encryption key.
18/27
Autokey Vigenère cipher example
• e.g. Plaintext x = VICTORY IS NEAR NO RETREAT ,
(spaces shown for optics only),
shared key Ks = COVID
• The encryption key is
k = COVIDVICTORYISNEARNORETREAT
Ciphertext, y = XWXBRMGKLBVYZFBVEKESRX
• Decryption: The key Ks = COVID is first used to decrypt
XWXBR to obtain VICTO
• Then VICTO is used as key to decrypt MGKLB to obtain
RYISN, and so on.
19/27
Transposition ciphers - rail fence
20/27
Transposition using keyword
21/27
Modern ciphers principles
22/27
Two common attacks – 1.Brute force
attack
23/27
Two common attacks – 2. Frequency
analysis
24/27
Frequency analysis attack
26/27
Summary
27/27