Chapter 2
Chapter 2
Chapter 2
Classic Cryptography
Index
A. Introduction
A.1 Cryptosystems
A.2 Terminology
B. Classic Cipher (Substitution Cipher)
B.1 Caesar Cipher
B 2 Tap Code
B.3 Pigpen Cipher
B 4 Vigenere Cipher
B 5 Book Cipher
C. Cryptanalysis of Substitution Cipher
C.1 Brute force cryptanalysis
C.2 Frequency Distribution Analysis
D. Calculation of Modulo operation
E. One-Time Pad
F. Classic Cipher( Transposition Cipher)
F.1 Route Cipher
F.2 Rail Fence Cipher
F.3 Column Cipher
Cryptosystems
A. Ciphers
C.
C. Modern
Modern
B.
B. Classic
Classic
B.1
B.1 Substitution
Substitution
e.g.,
e.g.,
Caesar
Caesar Cipher
Cipher
B.2
B.2 Transposition
Transposition
e.g.,
e.g.,
Route
Route Cipher
Cipher
B.3
B.3
Hybrid
Hybrid
C.1
C.1 Symmetric
Symmetric
((Private
Private Key
Key))
Stream
Stream Cipher
Cipher
e.g.,
e.g.,
RC4,
RC4, A5/1
A5/1
C.2
C.2 Asymmetric
Asymmetric
Public Key
((Public
Key))
e.g.,
e.g.,
RSA
RSA
Block
Block Cipher
Cipher
e.g.,
e.g.,
DES,
DES, AES
AES
C.3
C.3
Hybrid
Hybrid
A. Terminology
4
Terminology
5
Ciphertext
Decrypt
Terminology
6
Plaintext
Ciphertext
Decrypt
Terminology
7
Plaintext
message
At 2 o'clock
..
Encrypt key
k
Decrypt key
k
Encrypt
Decrypt
&*k+u7@~1
transmitted over an
insecure channel.
Plaintext
message
Terminology
8
B. Classic Cipher
9
1. Substitution Ciphers:
exchange one letter (or more) with another
letter/number/symbol/sound/art
A mono-alphabetic cipher uses fixed substitution over the
entire message,
A poly-alphabetic cipher uses a number of substitutions at
different times in the message
2. Transposition Ciphers:
re-arrange the order of the letters
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
For example,
Plaintext : treaty impossible
Key
:3
Ciphertext: wuhdwb lpsrvvleoh
It is the simplest monoalphabetic cipher. Caesar cipher using the shift parameter as the
key:
15
text: WTAAD
WTAAD
xt: hello
Questions Review
Q1. Use the Caesar cipher to find the plaintext and the key from the
ciphertext:
Ciphertext : ugehmlwj kwumjalq
Q2. Use the Caesar cipher with key=3 to encrypt the next message:
Plaintext: the quick brown fox jumps over the lazy dog
Substitution Cipher
Pigpen Cipher
Each letter is replaced by an art
20
Vigenre Tableau
B.1. Substitution
3.Vigenere algorithm
23
is a Polyalphabetic Cipher that
uses Caesar Cipher with more
than one key.
This
B.1. Substitution
3.Vigenere algorithm
We can notice from the above example that four keys are used for encryption
and decryption.
- Keys range from 1 to 25.
- Four keys are used in the above example (5,9,18 and 24)
- Encryption is done by using first key ( i.e. 5) to encrypt first letter A, Second
letter B is encrypted using key =9 and C is encrypted using key 18 and a letter
D is encrypted using key= 24.
- When we used all keys the process is repeated and a second round is made. So
when we reach letter E, we encrypt it again using key = 5 and letter F is
encrypted using key=9 and etc
- To decrypt the cipher, we should know what the letters that each key encrypts
is. This is can be done by using array of letter indexes (i.e. Key = 5 encrypts
letter in indexes 0, 4,8,12 .
- The Excel sheet will spread to the students and they should try it by adjusting
some parameters keys.
-
Question Review
Q1:Use the Vigenere cipher with key=lemon to
encrypt the message attackatdawn
- Students can guess the key by using brute force technique. - For example in the above
program, the key was set to 3.
Matched!!
So key =3
Plaintext
8 15 7
17
Numeric Equivalent
21 4 17 13 0 12 2
+ Random Number
76 48 16 82 44 3 58 11 60 5 47
= Sum
= mod 26
88
97 52 33 95 44 15 60 19 75 12 51 105
19 0
7 17 18 15 8 19 23 12 25
Ciphertext
Ciphertext
Numeric Equivalent
- One-time pad
= Difference
19 0
7 17 18 15 8 19 23 12 25
76 48 16 82 44 3 58 11 60 5 47
1
88
= mod 26
21 4 17 13 0 12 2
8 15 7
17
Plaintext
Observations:
The repeated letter comes from different plaintext letters
Duplicate ciphertext letters are generally unrelated when this
encryption algorithm is used => there is no information in the
message to be exploited
Disadvantages
The key cannot be memorized, both sender and receiver must
carry a written copy with them
Total amount of data can be transmitted is limited by the amount
of key available
Aabsolute synchronisation is between sender and receiver,
otherwise, it fails completely to protect message integrity)
For example:
Plaintext (M): WE ARE DISCOVERED FLEE AT ONCE
Key (K):
632415
Example:Columnar cipher
Question review
Q1. Encrypt the following plaintext using Columnar
transposition:
We are going to university every day
Use your Last name as keyword
Q2.use the rail fence Cipher (3 rails) to encode the following plaintext
Plaintext: We are going to university every day
Question review
Q3. They
44