<<

Classical

Caesar

Monoalphabetic Ciphers

Playfair Cipher Classical Ciphers

Polyalphabetic Ciphers Vigen`ereCipher Cryptography Vernam Cipher One Time Pad School of Engineering and Technology Transposition CQUniversity Australia Techniques

Prepared by Steven Gordon on 19 Feb 2020, classical.tex, r1789

1/64 Cryptography Contents Classical Ciphers

Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

2/64 Cryptography Caesar Cipher () Classical Ciphers To encrypt with a k, shift each letter of the plaintext k Caesar Cipher positions to the right in the alphabet, wrapping back to the Monoalphabetic Ciphers start of the alphabet if necessary. To decrypt, shift each Playfair Cipher letter of the k positions to the left (wrapping if Polyalphabetic Ciphers necessary).

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

3/64 Cryptography Caesar Cipher (exercise) Classical Ciphers Using the Caesar cipher, encrypt plaintext hello with key 3. Caesar Cipher

Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

4/64 Cryptography How many keys are possible in the Caesar Classical Ciphers cipher? (question) Caesar Cipher Monoalphabetic If the Caesar cipher is operating on the characters a–z, then Ciphers how many possible keys are there? Is a key of 0 possible? Is Playfair Cipher it a good choice? What about a key of 26? Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

5/64 Cryptography Caesar Cipher Decryption (exercise) Classical Ciphers You have received the ciphertext TBBQOLR. You know the Caesar Cipher Caesar cipher was used with key n. Find the plaintext. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

6/64 Cryptography Caesar Cipher, formal (algorithm) Classical Ciphers

Caesar Cipher C = E(K, P) = (P + K) mod 26 (1) Monoalphabetic Ciphers P = D(K, C) = (C − K) mod 26 (2) Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

7/64 Cryptography Caesar Cipher, formal (exercise) Classical Ciphers Consider the following mapping. Caesar Cipher abcdefghijklm Monoalphabetic Ciphers 0 1 2 3 4 5 6 7 8 9 10 11 12 Playfair Cipher nopqrstuvwxyz Polyalphabetic Ciphers 13 14 15 16 17 18 19 20 21 22 23 24 25

Vigen`ereCipher Use the the formal (mathematical) algorithm for Caesar

Vernam Cipher cipher to decrypt SDV with key p.

One Time Pad

Transposition Techniques

8/64 Cryptography Caesar Encrypt and Decrypt (python) Classical Ciphers

Caesar Cipher 1 >>> pycipher.Caesar(3).encipher("hello") 2 Monoalphabetic ’KHOOR’ Ciphers 3 >>> pycipher.Caesar(3).decipher("khoor") Playfair Cipher 4 ’HELLO’

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

9/64 Cryptography Brute Force Attack (definition) Classical Ciphers Try all combinations (of keys) until the correct plaintext/key Caesar Cipher is found. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

10/64 Cryptography Caesar Brute Force (exercise) Classical Ciphers The ciphertext FRUURJVBCANNC was obtained using the Caesar Cipher Caesar cipher. Find the plaintext using a brute force attack. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

11/64 Cryptography Caesar Brute Force (python) Classical Ciphers

Caesar Cipher 1 for k in range(0,26): 2 Monoalphabetic pycipher.Caesar(k).decipher("FRUURJVBCANNC") Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

12/64 Cryptography Caesar Brute Force Results (text) Classical Ciphers

Caesar Cipher 0: FRUURJVBCANNC 13: SEHHEWIOPNAAP

Monoalphabetic 1: EQTTQIUABZMMB 14: RDGGDVHNOMZZO Ciphers 2: DPSSPHTZAYLLA 15: QCFFCUGMNLYYN Playfair Cipher 3: CORROGSYZXKKZ 16: PBEEBTFLMKXXM

Polyalphabetic 4: BNQQNFRXYWJJY 17: OADDASEKLJWWL Ciphers 5: AMPPMEQWXVIIX 18: NZCCZRDJKIVVK Vigen`ereCipher 6: ZLOOLDPVWUHHW 19: MYBBYQCIJHUUJ

Vernam Cipher 7: YKNNKCOUVTGGV 20: LXAAXPBHIGTTI 8: XJMMJBNTUSFFU 21: KWZZWOAGHFSSH One Time Pad 9: WILLIAMSTREET 22: JVYYVNZFGERRG Transposition Techniques 10: VHKKHZLRSQDDS 23: IUXXUMYEFDQQF 11: UGJJGYKQRPCCR 24: HTWWTLXDECPPE 12: TFIIFXJPQOBBQ 25: GSVVSKWCDBOOD

13/64 Cryptography How many attempts for Caesar brute force? Classical Ciphers (question) Caesar Cipher Monoalphabetic What is the worst, best and average case of number of Ciphers attempts to brute force ciphertext obtained using the Caesar Playfair Cipher cipher? Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

14/64 Cryptography Recognisable Plaintext upon Decryption Classical Ciphers (assumption) Caesar Cipher Monoalphabetic The decrypter will be able to recognise that the plaintext is Ciphers correct (and therefore the key is correct). Decrypting Playfair Cipher ciphertext using the incorrect key will not produce the Polyalphabetic Ciphers original plaintext. The decrypter will be able to recognise Vigen`ereCipher that the key is wrong, i.e. the decryption will produce Vernam Cipher unrecognisable output. One Time Pad

Transposition Techniques

15/64 Cryptography Is plaintext always recognisable? (question) Classical Ciphers Caesar cipher is using recognisably correct plaintext, i.e. Caesar Cipher English words. But is the correct plaintext always Monoalphabetic Ciphers recognisable? What if the plaintext was a different Playfair Cipher language? Or compressed? Or it was an image or video? Or Polyalphabetic Ciphers binary file, e.g. .exe? Or a set of characters chosen

Vigen`ereCipher randomly, e.g. a key or password?

Vernam Cipher

One Time Pad

Transposition Techniques

16/64 Cryptography How to improve upon the Caesar cipher? Classical Ciphers

Caesar Cipher 1. Increase the key space so brute force is harder Monoalphabetic Ciphers 2. Change the plaintext (e.g. compress it) so harder to

Playfair Cipher recognise structure

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

17/64 Cryptography Contents Classical Ciphers

Caesar Cipher Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

18/64 Cryptography Permutation (definition) Classical Ciphers A permutation of a finite set of elements is an ordered Caesar Cipher sequence of all the elements of S, with each element Monoalphabetic Ciphers appearing exactly once. In general, there are n! Playfair Cipher permutations of a set with n elements. Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

19/64 Cryptography Permutation (example) Classical Ciphers Consider the set S = {a, b, c}. There are six permutations Caesar Cipher of S: Monoalphabetic Ciphers abc, acb, bac, bca, cab, cba Playfair Cipher This set has 3 elements. There are 3! = 3 × 2 × 1 = 6 Polyalphabetic Ciphers permutations.

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

20/64 Cryptography Monoalphabetic (Substitution) Cipher Classical Ciphers (definition) Caesar Cipher Monoalphabetic Given the set of possible plaintext letters (e.g. English Ciphers alphabetc, a–z), a single permutation is chosen and used to Playfair Cipher determine the corresponding ciphertext letter. Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

21/64 Cryptography Monoalphabetic (Substitution) Cipher (example) Classical Ciphers In advance, the sender and receiver agree upon a Caesar Cipher permutation to use, e.g.: Monoalphabetic Ciphers P:abcdefghijklmnopqrstuvw Playfair Cipher x y z Polyalphabetic Ciphers C:HPWNSKLEVAYCXOFGTBQRUID

Vigen`ereCipher JZM

Vernam Cipher To encrypt the plaintext hello, the agreed upon One Time Pad permutation (or mapping) is used to produce the ciphertext Transposition ESCCF. Techniques

22/64 Cryptography Decrypt Monoalphabetic Cipher (exercise) Classical Ciphers Decrypt the ciphertext QSWBSR using the permutation Caesar Cipher chosen in the previous example. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

23/64 Cryptography How many keys in English monoalphabetic Classical Ciphers cipher? (question) Caesar Cipher Monoalphabetic How many possible keys are there for a monoalphabetic Ciphers cipher that uses the English lowercase letters? What is the Playfair Cipher length of an actual key? Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

24/64 Cryptography Brute Force on Monoalphabetic Cipher (exercise) Classical Ciphers You have intercepted a ciphertext message that was Caesar Cipher obtained with an English monoalphabetic cipher. You have a Monoalphabetic Ciphers Python function called: Playfair Cipher mono decrypt and check(ciphertext,key) Polyalphabetic Ciphers that decrypts the ciphertext with a key, and returns the

Vigen`ereCipher plaintext if it is correct, otherwise returns false. You have

Vernam Cipher tested the Python function in a while loop and the One Time Pad can apply the function at a rate of 1,000,000,000 times per Transposition second. Find the average time to perform a brute force on Techniques the ciphertext.

25/64 Cryptography Attack (definition) Classical Ciphers Find (portions of the) key and/or plaintext by using insights Caesar Cipher gained from comparing the actual frequency of letters in the Monoalphabetic Ciphers ciphertext with the expected frequency of letters in the Playfair Cipher plaintext. Can be expanded to analyse sets of letters, e.g. Polyalphabetic Ciphers digrams, trigrams, n-grams, words.

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

26/64 Cryptography Relative Frequency of Letters in Large Sample of Classical Ciphers English Text Caesar Cipher

Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

Credit: Figure 2.5 in Stallings, Cryptography and Network Security, 5th Ed., Pearson 2011 27/64 Cryptography Relative Frequency of Letters by Norvig Classical Ciphers

Caesar Cipher

Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

28/64 Credit: Letter Counts by Peter Norvig, http://norvig.com/mayzner.html Cryptography Relative Frequency of Digrams by Norvig Classical Ciphers

Caesar Cipher

Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

Credit: Two-Letter Sequence (Bigram) Counts by Peter Norvig, http://norvig.com/mayzner.html

29/64 Cryptography Relative Frequency of N-Grams by Norvig Classical Ciphers

Caesar Cipher

Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

Credit: N-Letter Sequences (N-grams)” by Peter Norvig, http://norvig.com/mayzner.html

30/64 Cryptography Break a Monoalphabetic Cipher (exercise) Classical Ciphers Ciphertext: Caesar Cipher ziolegxkltqodlzgofzkgrxetngxzgzithkofeohs Monoalphabetic Ciphers tlqfrzteifojxtlgyltexkofuegdhxztklqfregd Playfair Cipher hxztkftzvgkalvoziygexlgfofztkftzltexkoznz Polyalphabetic Ciphers itegxkltoltyytezoctsnlhsozofzgzvghqkzlyo

Vigen`ereCipher klzofzkgrxeofuzitzitgkngyeknhzgukqhinofes

Vernam Cipher xrofuigvdqfnesqlloeqsqfrhghxsqkqsugkozid One Time Pad lvgkaturtlklqrouozqsloufqzxktlqfrltegfrhk Transposition gcorofurtzqoslgyktqsofztkftzltexkoznhkgz Techniques gegslqsugkozidlqfrziktqzltuohltecokxltlyo ktvqsslitfetngxvossstqkfwgzizitgktzoeqsq lhtezlgyegdhxztkqfrftzvgkaltexkoznqlvtssq ligvziqzzitgknolqhhsotrofzitofztkftzziol afgvstrutvossitshngxofrtloufofuqfrrtctsgh ofultexktqhhsoeqzogflqfrftzvgkahkgzgegsl qlvtssqlwxosrofultexktftzvgkal

31/64 Cryptography Contents Classical Ciphers

Caesar Cipher Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

32/64 Cryptography Playfair Matrix Construction (algorithm) Classical Ciphers Write the letters of keyword k row-by-row in a 5-by-5 matrix. Caesar Cipher Do not include duplicate letters. Fill the remainder of the Monoalphabetic Ciphers matrix with the alphabet. Treat the letters i and j as the Playfair Cipher same (that is, they are combined in the same cell of the Polyalphabetic Ciphers matrix).

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

33/64 Cryptography Playfair Matrix Construction (exercise) Classical Ciphers Construct the Playfair matrix using keyword australia. Caesar Cipher

Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

34/64 Cryptography Playfair Encryption (algorithm) Classical Ciphers Split the plaintext into pairs of letters. If a pair has identical Caesar Cipher letters, then insert a special letter x in between. If the Monoalphabetic Ciphers resulting set of letters is odd, then pad with a special letter x. Playfair Cipher Locate the plaintext pair in the Playfair matrix. If the pair Polyalphabetic Ciphers is on the same column, then shift each letter down one cell

Vigen`ereCipher to obtain the resulting ciphertext pair. Wrap when necessary.

Vernam Cipher If the plaintext pair is on the same row, then shift to the One Time Pad right one cell. Otherwise, the first ciphertext letter is that on Transposition the same row as the first plaintext letter and same column Techniques as the second plaintext letter, and the second ciphertext letter is that on the same row as the second plaintext letter and same column as the first plaintext letter. Repeat for all plaintext pairs.

35/64 Cryptography Playfair Encryption (exercise) Classical Ciphers Find the ciphertext if the Playfair cipher is used with Caesar Cipher keyword australia and plaintext hello. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

36/64 Cryptography Does Playfair cipher always map a letter to the Classical Ciphers same ciphertext letter? (question) Caesar Cipher Monoalphabetic Using the Playfair cipher with keyword australia, encrypt Ciphers the plaintext hellolove. Playfair Cipher With the Playfair cipher, if a letter occurs multiple times in Polyalphabetic Ciphers the plaintext, will that letter always encrypt to the same Vigen`ereCipher ciphertext letter? Vernam Cipher If a pair of letters occurs multiple times, will that pair One Time Pad always encrypt to the same ciphertext pair? Transposition Techniques Is the Playfair cipher subject to frequency analysis attacks?

37/64 Cryptography Contents Classical Ciphers

Caesar Cipher Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

38/64 Cryptography Polyalphabetic (Substitution) Cipher (definition) Classical Ciphers Use a different monoalphabetic substitution as proceeding Caesar Cipher through the plaintext. A key determines which Monoalphabetic Ciphers monoalphabetic substitution is used for each transformation. Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

39/64 Cryptography Examples of Polyalphabetic Ciphers Classical Ciphers

Caesar Cipher I Vigen`ereCipher: uses Caesar cipher, but Caesar key Monoalphabetic changes each letter based on keyword Ciphers Playfair Cipher I Vernam Cipher: binary version of Vigen`ere,using XOR Polyalphabetic One Time Pad: same as Vigen`ere/Vernam, but random Ciphers I

Vigen`ereCipher key as long as plaintext

Vernam Cipher

One Time Pad

Transposition Techniques

40/64 Cryptography Contents Classical Ciphers

Caesar Cipher Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

41/64 Cryptography Vigen`ereCipher (algorithm) Classical Ciphers For each letter of plaintext, a Caesar cipher is used. The key Caesar Cipher for the Caesar cipher is taken from the Vigen`erekey(word), Monoalphabetic Ciphers progressing for each letter and wrapping back to the first Playfair Cipher letter when necessary. Formally, encryption using a keyword Polyalphabetic Ciphers of length m is:

Vigen`ereCipher

Vernam Cipher ci = (pi + ki mod m) mod 26

One Time Pad where p is letter i (starting at 0) of plaintext P, and so on. Transposition i Techniques

42/64 Cryptography Vigen`ereCipher Encryption (example) Classical Ciphers Using the Vigen`erecipher to encrypt the plaintext Caesar Cipher carparkbehindsupermarket with the keyword sydney Monoalphabetic Ciphers produces the ciphertext UYUCEPCZHUMLVQXCIPEYUXIR. The Playfair Cipher keyword would be repeated when Caesar is applied: Polyalphabetic Ciphers P: carparkbehindsupermarket

Vigen`ereCipher K: sydneysydneysydneysydney

Vernam Cipher C: UYUCEPCZHUMLVQXCIPEYUXIR

One Time Pad

Transposition Techniques

43/64 Cryptography Vigen`ereCipher Encryption (exercise) Classical Ciphers Use Python (or other software tools) to encrypt the plaintext Caesar Cipher centralqueensland with the following keys with the Monoalphabetic Ciphers Vigen`erecipher, and investigate any possible patterns in the Playfair Cipher ciphertext: cat, dog, a, giraffe. Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

44/64 Cryptography Weakness of Vigen`ereCipher Classical Ciphers

Caesar Cipher I Determine the length of the keyword m Monoalphabetic I Repeated n-grams in the ciphertext may indicate Ciphers repeated n-grams in the plaintext Playfair Cipher I Separation between repeated n-grams indicates possible Polyalphabetic Ciphers keyword length m

Vigen`ereCipher I If plaintext is long enough, multiple repetitions make it easier to find m Vernam Cipher One Time Pad I Treat the ciphertext as that from m different Transposition monoalphabetic ciphers Techniques I E.g. Caesar cipher with m different keys I Break the monoalphabetic ciphers with frequency analysis I With long plaintext, and repeating keyword, Vigen`ere can be broken

45/64 Cryptography Breaking Vigen`ereCipher (example) Classical Ciphers Ciphertext ZICVTWQNGRZGVTWAVZHCQYGLMGJ has repetition Caesar Cipher of VTW. That suggests repetition in the plaintext at the same Monoalphabetic Ciphers position, which would be true if the keyword repeated at the Playfair Cipher same position. Polyalphabetic Ciphers 012345678901234567890123456

Vigen`ereCipher ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Vernam Cipher That is, it is possible the key letter at position 3 is the One Time Pad repated at position 12. That in turn suggest a keyword Transposition length of 9 or 3. Techniques ciphertext ZICVTWQNGRZGVTWAVZHCQYGLMGJ length=3: 012012012012012012012012012 length=9: 012345678012345678012345678 An attacker would try both keyword lengths. With a keyword length of 9, the attacker then performs Caesar cipher frequency analysis on every 9th letter. Eventually they find plaintext is wearediscoveredsaveyourself and keyword is deceptive. 46/64 Cryptography Contents Classical Ciphers

Caesar Cipher Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

47/64 Cryptography Vernam Cipher (algorithm) Classical Ciphers Encryption is performed as: Caesar Cipher

Monoalphabetic Ciphers ci = pi ⊕ ki Playfair Cipher

Polyalphabetic decryption is performed as: Ciphers

Vigen`ereCipher pi = ci ⊕ ki Vernam Cipher

One Time Pad where pi is the ith bit of plaintext, and so on. The key is Transposition Techniques repeated where necessary.

48/64 Cryptography XOR (python) Classical Ciphers

Caesar Cipher 1 >>> def xor(x, y): 2 Monoalphabetic ... return ’{1:0{0}b}’.format(len(x), int(x, 2) ^ int(y, 2)) Ciphers 3 ... Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

49/64 Cryptography Vernam Cipher Encryption (exercise) Classical Ciphers Using the Vernam cipher, encrypt the plaintext Caesar Cipher 011101010101000011011001 with the key 01011. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

50/64 Cryptography Vernam Cipher Encryption (python) Classical Ciphers

Caesar Cipher 1 >>> xor(’011101010101000011011001’,’010110101101011010110101’) 2 Monoalphabetic ’001011111000011001101100’ Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

51/64 Cryptography Contents Classical Ciphers

Caesar Cipher Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

52/64 Cryptography One-Time Pad (algorithm) Classical Ciphers Use (such as Vigen`ereor Vernam) but Caesar Cipher where the key must be: random, the same length as the Monoalphabetic Ciphers plaintext, and not used multiple times. Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

53/64 Cryptography Properties of OTP Classical Ciphers

Caesar Cipher I Encrypting plaintext with random key means output Monoalphabetic ciphertext will be random Ciphers I E.g. XOR plaintext with a random key produces random Playfair Cipher sequence of bits in ciphertext Polyalphabetic Ciphers I Random ciphertext contains no information about the Vigen`ereCipher structure of plaintext Vernam Cipher I Attacker cannot analyse ciphertext to determine One Time Pad plaintext Transposition Brute force attack on key is ineffective Techniques I I Multiple different keys will produce recognisable plaintext I Attacker has no way to determine which of the plaintexts are correct I OTP is only known unbreakable (unconditionally secure) cipher

54/64 Cryptography Attacking OTP (example) Classical Ciphers Consider a variant of Vigen`erecipher that has 27 characters Caesar Cipher (including a space). An attacker has obtained the ciphertext: Monoalphabetic Ciphers ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS Playfair Cipher Attacker tries all possible keys. Two examples: Polyalphabetic Ciphers k1: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih

Vigen`ereCipher p1: mr mustard with the candlestick in the hall

Vernam Cipher k2: pftgpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt One Time Pad p2: miss scarlet with the knife in the library Transposition There are many other legible plaintexts obtained with other Techniques keys. No way for attacker to know the correct plaintext

55/64 Cryptography Summary of OTP Classical Ciphers

Caesar Cipher I Only known unbreakable (unconditionally secure) cipher Monoalphabetic Ciphers I Ciphertext has no statistical relationship with plaintext Playfair Cipher I Given two potential plaintext messages, attacker cannot Polyalphabetic Ciphers identify the correct message Vigen`ereCipher I But two significant practical limitations: Vernam Cipher 1. Difficult to create large number of random keys One Time Pad 2. Distributing unique long random keys is difficult Transposition Techniques I Limited practical use

56/64 Cryptography Contents Classical Ciphers

Caesar Cipher Caesar Cipher Monoalphabetic Ciphers

Playfair Cipher Monoalphabetic Ciphers

Polyalphabetic Ciphers Playfair Cipher Vigen`ereCipher Vernam Cipher Polyalphabetic Ciphers One Time Pad

Transposition Techniques Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

57/64 Cryptography Transposition vs Substitution Classical Ciphers

Caesar Cipher I Substitution: replace one (or more) character in Monoalphabetic plaintext with another from the entire possible Ciphers character set Playfair Cipher

Polyalphabetic I Transposition: re-arrange the characters in the plaintext Ciphers Vigen`ereCipher I The set of characters in the ciphertext is the same as in Vernam Cipher the plaintext One Time Pad I Problem: the plaintext frequency statistics are also in Transposition the ciphertext Techniques I On their own, transposition techniques are easy to break I Combining transposition with substitution makes ciphers stronger, and building block of modern ciphers

58/64 Cryptography Encryption (definition) Classical Ciphers Select a depth as a key. Write the plaintext in diagonals in a Caesar Cipher zig-zag manner to the selected depth. Read row-by-row to Monoalphabetic Ciphers obtain the ciphertext. Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

59/64 Cryptography Rail Fence Encryption (exercise) Classical Ciphers Consider the plaintext securityandcryptography with key Caesar Cipher 4. Using the rail fence cipher, find the ciphertext. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

60/64 Cryptography Rows Columns Cipher Encryption (definition) Classical Ciphers Select a number of columns m and permutate the integers Caesar Cipher from 1 to m to be the key. Write the plaintext row-by-row Monoalphabetic Ciphers over m columns. Read column-by-column, in order of the Playfair Cipher columns determined by the key, to obtain the ciphertext. Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

61/64 Cryptography Rows Columns Encryption (exercise) Classical Ciphers Consider the plaintext securityandcryptography with key Caesar Cipher 315624. Using the rows columns cipher, find the ciphertext. Monoalphabetic Ciphers

Playfair Cipher

Polyalphabetic Ciphers

Vigen`ereCipher

Vernam Cipher

One Time Pad

Transposition Techniques

62/64 Cryptography Rows Columns Multiple Encryption (example) Classical Ciphers Assume the ciphertext from the previous example has been Caesar Cipher encrypted again with the same key. The resulting ciphertext Monoalphabetic Ciphers is YYCPRRCTEOIPDRAHYSGUATXH. Now let’s view how the Playfair Cipher cipher has “mixed up” the letters of the plaintext. If the Polyalphabetic Ciphers plaintext letters are numbered by position from 01 to 24,

Vigen`ereCipher their order (split across two rows) is:

Vernam Cipher 01 02 03 04 05 06 07 08 09 10 11 12 One Time Pad 13 14 15 16 17 18 19 20 21 22 23 24 Transposition After first encryption the order becomes: Techniques 02 08 14 20 05 11 17 23 01 07 13 19 06 12 18 24 03 09 15 21 04 10 16 22 After the second encryption the order comes: 08 23 12 21 05 13 03 16 02 17 06 15 11 19 09 20 14 01 18 04 20 07 24 10 Are there any obviously obversvable patterns?

63/64 Cryptography Summary of Transposition and Substitution Classical Ciphers Ciphers Caesar Cipher

Monoalphabetic Ciphers I Transposition ciphers on their own offer no practical Playfair Cipher security Polyalphabetic Ciphers I But combining transposition ciphers with substitution

Vigen`ereCipher ciphers, and repeated applications, practical security

Vernam Cipher can be achieved One Time Pad I Modern symmetric ciphers use multiple applications Transposition Techniques (rounds) of substitition and transposition (permutation) operations

64/64