Download presentation
1
Chapter Two: Classic Cryptography
2
Index 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
3
Cryptosystems A. Ciphers B. Classic B.1 Substitution
e.g., Caesar Cipher B.2 Transposition e.g., Route Cipher B.3 Hybrid C. Modern C.1 Symmetric (Private Key) Stream Cipher e.g., RC4, A5/1 Block Cipher e.g., DES, AES C.2 Asymmetric (Public Key) e.g., RSA C.3 Hybrid
4
A. Terminology Cryptology is the art and science of making and breaking “secret codes.” Cryptography is the making of “secret codes.” Cryptanalysis is the breaking of “secret codes.” Crypto is a synonym for any or all of the above (and more). Cipher (صفر) is an algorithm for performing encryption and decryption — a series of well-defined steps that can be followed as a procedure.
5
Terminology Encryption is the process of encoding a message so that its meaning is not obvious Equivalent terms: encode, encipher Decryption is the reverse process, transforming an encrypted message back into its normal, original form Equivalent terms: decode, decipher Encrypt Plaintext Ciphertext Decrypt
6
Terminology Encryption/decryptions algorithms often use a device called a key, so that the resulting ciphertext depends on the original plaintext message, the algorithm, and the key value An encryption scheme that does not require the use of a key is called a keyless cipher The cryptosystem involves a set of rules for how to encrypt the plaintext and how to decrypt the ciphertext Encrypt Plaintext Ciphertext Decrypt
7
Terminology Plaintext: message to be encrypted
Ciphertext: encrypted message DK(EK(P)) = P
8
Terminology Symmetric uses same key for encryption and decryption process. To encrypt: C = E(K, P) To decrypt: P = D (K, E(K,P)) Asymmetric uses different key for encryption and decryption process. To encrypt: C = E (KE,P) To decrypt: P = D (KD, E (KE,P))
9
B. Classic Cipher 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 Transposition Ciphers: re-arrange the order of the letters
10
B.1. Substitution Ciphers 1. Caesar Cipher
Idea: each letter or group of letters is replaced by another letter or group of letters Caesar cipher – circularly shift by 3 letters a -> D, b -> E, … z -> C More generally, shift by k letters, k is the key
11
B.1. Substitution Ciphers 1. Caesar Cipher
It is monoalphabetic cipher uses addition modulo 26 The message must be a sequence of letters, each letter is identified with a number: The key k is a number in the range 1 … 25. Advantages and Disadvantages: The Caesar cipher is quite simple The ability of predict the entire algorithm using small piece of ciphertext
12
B.1. Substitution Ciphers 1. Caesar Cipher (Algorithms)
Encryption/decryption involve ± k to each letter (mod 26). So the general Caesar algorithm is Ci= Ek(Mi) = E(Mi, k) = (Mi+k) mod 26 Mi= Dk(Ci) = D(Ci, k) = (Ci-k) mod 26 For example, Plaintext : treaty impossible Key : ± 3 Ciphertext: wuhdwb lpsrvvleoh That is, Ci=E[Mi , 3] = Mi+3 mod 26
13
B.1. Substitution Ciphers 1. Caesar Cipher
It is the simplest monoalphabetic cipher. Caesar cipher using the shift parameter as the key:
14
Example: Caeser Cipher (Encryption)
15
Example: Caesar Cipher (Decryption)
16
Example: Caesar cipher (Encryption)
Use the Caesar cipher with key=15 to encrypt the message “hello” Ciphertext: WTAAD
17
Example: Caesar Cipher (Decryption)
Use the Caesar cipher with key=15 to decrypt the message “WTAAD” Ciphertext: hello
18
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
19
B.1. Substitution Ciphers 2. Tap Code
Each letter is replaced by a number of beeps
20
Substitution Cipher Pigpen Cipher
Each letter is replaced by an art
21
B.1. Substitution Ciphers 3. Vigenère Cipher
Polyalphabetic ciphers flatten the frequency distribution of the plaintext considerably. Vigenère Cipher is an example of polyalphabetic ciphers - use different monoalphabetic substitutions as one proceeds through the plaintext message. For example: Plaintext (M) meet me at ten Key (K) badb ad ba dba Ciphertext(C) nehu mh bt wfn where C = M+K mod 26
22
B.1. Substitution Ciphers 3. Vigenère Cipher
Vigenère Tableau
23
B.1. Substitution 3.Vigenere algorithm
This is a Polyalphabetic Cipher that uses Caesar Cipher with more than one key.
24
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.
25
Question Review Q1:Use the Vigenere cipher with key=lemon to encrypt the message “attackatdawn”
26
B.1. Substitution Ciphers 4. Book Cipher
Any book can provide a key The key is formed from the letter of the text Steps: select a passage (Key) “the page cannot be found” match the plaintext with selected text. Plaintext “MACHINES CANNOT THINK” encode plaintext using Vigenere table
27
B.1. Substitution Ciphers Cryptanalysis
Brute force cryptanalysis: would have to try 26! permutations of a particular ciphertext message. Students can guess the key by using brute force technique. - For example in the above program, the key was set to 3.
28
Brute force cryptanalysis (cont)
Try key = 0, the decrypted cipher will be: Try key = 1, the decrypted cipher will be: Try key = 2, the decrypted cipher will be: Try key = 3, the decrypted cipher will be: Matched!! So key =3
29
B.1. Substitution Ciphers Cryptanalysis (cont)
2. Frequency Distribution Analysis: In practice, it is not difficult to determine the key using frequencies of letters, pairs of letter etc., or by guessing a probable word or phrase Most frequently occurred Letters: e, t, o, a, n, … Digrams: th, in, er, re, an, … Trigrams: the, ing, and, ion, ent Words: the, of, and, to, a, in, that,
30
B.1. Substitution Ciphers 7. One-Time Pads
31
B.1. Substitution Ciphers 7. One-Time Pads (using Bits)
One-time pad: construct an unbreakable cipher Choose a random bit string as the key Convert the plaintext into a bit string Compute the XOR of these two strings, bit by bit The resulting ciphertext cannot be broken, because in a sufficiently large sample of ciphertext, each letter will occur equally often, as will every diagram, every trigram, and so on => There is simply no information in the message because all possible plaintexts of the given length are equally likely The Vernam Cipher is a type of one-time pad devised by Gilbert Vernam for AT&T
32
Calculation of MOD operation
Calculate the following mod: E.g., (5) mod 21 =5 (30) mod 21 = (9) mod 21 =9
33
Calculation Negative MOD
Modula always return non-negative number: Calculate the following mod E.g., (-57) mod 21 = (-36) mod 21 = (-15) mod 21 = (6) mod 21 =6
34
B.1. Substitution Ciphers 7. One-Time Pads (using ASCII Code)
Plaintext V E R N A M C I P H Numeric Equivalent 21 4 17 13 12 2 8 15 7 + Random Number 76 48 16 82 44 3 58 11 60 5 47 88 = Sum 97 52 33 95 19 75 51 105 = mod 26 18 23 25 1 Ciphertext t a h r s p i x m z b To decrypt: (Ci – Ki) mod 26 Note on rules of mod on negative number: “The mod function is defined as the amount by which a number exceeds the largest integer multiple of the divisor that is not greater than that number” ( Modula op always return non-negative number E.g., (19-76) mod 26 = (-57) mod 26 = (-78+21) mod 26 = 21 Ciphertext t a h r s p i x m z b Numeric Equivalent 19 7 17 18 15 8 23 12 25 1 - One-time pad 76 48 16 82 44 3 58 11 60 5 47 88 = Difference -57 -48 -9 -65 -26 -50 -37 -22 -87 = mod 26 21 4 13 2 Plaintext V E R N A M C I P H
35
B.1. Substitution Ciphers 7. One-Time Pads
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)
36
B.2. Transposition Ciphers
Transposition cipher – reorders (rearrange) symbols but does not disguise them. It is also called permutation With transposition, the cryptography aims for diffusion Widely spreading the information from the message or the key across the ciphertext Transpositions try to break established patterns
37
B.2. Transposition Ciphers 1. Route Cipher
38
B.2. Transposition Ciphers 2. Rail Fence Cipher
39
B.2. Transposition Ciphers 3. Columnar Transposition
Plaintext written in rows Number of columns = key length Key is used to number the columns Ciphertext reads out by columns, starting with column whose key letter is lowest
40
B.2. Transposition Ciphers 3. Columnar Transposition
For example: Plaintext (M): WE ARE DISCOVERED FLEE AT ONCE Key (K): Ciphertext(C): EVLNE ACDTK ESEAQ ROFOJ DEECU WIREE
41
Example:Columnar cipher
Ciphertext(C): EVLNX ACDTX ESEAX ROFOX DEECX WIREE Key: Plaintext (M): WE ARE DISCOVERED FLEE AT ONCE
42
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
43
Question review Q3. They are 4! = 24 possible combinations for the substations. Here some sample: Q4 . By using brute force we must try all 24 choices until we break the cipher.
44
Terms and Concepts Encryption & Decryption Plaintext & Ciphertext
Algorithm & Cipher Cryptology Cryptography & Cryptanalysis Key Substitution & Transposition Monoalphabetic Ciphers & Polyalphabetic Ciphers
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.