Polyalphabetic and Polygraphic Ciphers [0.5Ex] (Counting & Probability)
Total Page:16
File Type:pdf, Size:1020Kb
a. 2 · 26 · 26 · 26 = 35152. b. 2 · 25 · 24 · 23 = 27600. b. 2 · 25 · 24 · 23 = 27600. Scrambling Frequences I To get around the weakness of monoalphabetic ciphers, we need to somehow scramble letter frequences. Polyalphabetic and Polygraphic Ciphers I A polyalphabetic substitution cipher is a cipher in which there is not a 1–1 (Counting & Probability) map between plaintext and ciphertext letters. Example 1. Jim Royer ® Let S = f 00, 01, 02, . , 99 g = two digit strings. ® Define a map ai 7! Si, a subset of S 3 Intro. to Cryptography I S0,..., S25 are a partition of S. I (freq. of a ) ≈ kS k/kSk. September 6, 2018 i i So `e' will have about 12 different codes, but `x' will have just one. ® When encoding ai pick a random element of Si. ® In the ciphertext, the freq. of all two digit seqs. is about the same. To analyze such schemes we need counting & probability. Counting: The Multiplication Principle Counting: The Multiplication Principle The Multiplication Principle (Andrews, x3-1) The Multiplication Principle (Andrews, x3-1) If task 1 can be done p1 ways and If task 1 can be done p1 ways and task 2 can be done p2 ways and task 2 can be done p2 ways and ... ... task k can be done pk ways, task k can be done pk ways, then the total number of ways of doing all k tasks is then the total number of ways of doing all k tasks is p1 × p2 × · · · × pk p1 × p2 × · · · × pk Sample Problems Sample Problems How many different 4-letter radio station call letters Answers How many different 4-letter radio station call letters Answers can be made when can be made when a. 2 · 26 · 26 · 26 = 35152. a. The first letter must be either K or W. a. The first letter must be either K or W. b. The first letter must be either K or W b. The first letter must be either K or W and there are no repeated letters. and there are no repeated letters. Counting: The Multiplication Principle The Multiplication Principle: Puzzles The Multiplication Principle (Andrews, x3-1) If task 1 can be done p1 ways and task 2 can be done p2 ways and ... task k can be done pk ways, How many are there of: then the total number of ways of doing all k tasks is a. license plates with three letters followed by four digits? p1 × p2 × · · · × pk b. license plates as before, but no repeated letters? c. monoalphabetic ciphers? Sample Problems How many different 4-letter radio station call letters Answers can be made when a. 2 · 26 · 26 · 26 = 35152. a. The first letter must be either K or W. b. 2 · 25 · 24 · 23 = 27600. b. The first letter must be either K or W and there are no repeated letters. The Multiplication Principle: Puzzles Poly. Ciphers Permutations Counting How many are there of: a. license plates with three letters followed by four digits? b. license plates as before, but no repeated letters? c. monoalphabetic ciphers? The Multiplication Principle: Puzzles 2018-09-06 The “multiplication principle” is some times called Definition 2. A permutation is an ordering of a set of objects. • “Rule of product” (https://en.wikipedia.org/wiki/Rule_of_product) Puzzles • “general combinatorial principle” (Andrews, page 31) f g How many are there of: a.Q: How many permutations of a, b, c are there? a. license plates with three letters followed by four digits? b. There are four spies. We choose one a pilot and another as co-pilot. Q: How 26 · 26 · 26 · 10 · 10 · 10 · 10 = 263 · 104 = 175760000 many ways are there of doing this? b. license plates as before, but no repeated letters? c. There are five spies. Choose one to go to Miami and another to go to Watertown. Q: How many ways can we do this? 26 · 25 · 24 · 10 · 10 · 10 · 10 = 156000000. d. Same as above, but choose a 3rd to go to Kalamazoo. c. monoalphabetic ciphers? e.Q: How many permutations are there of r objects selected from a set of size n. 26! = 403291461126605635584000000. (Notation: P(r, n).) Permutations Permutations Poly. Ciphers Definition 2. Poly. Ciphers Definition 2. A permutation is an ordering of a set of objects. A permutation is an ordering of a set of objects. Counting Puzzles Counting Puzzles a.Q: How many permutations of f a, b, c g are there? a.Q: How many permutations of f a, b, c g are there? b. There are four spies. We choose one a pilot and another as co-pilot. Q: How b. There are four spies. We choose one a pilot and another as co-pilot. Q: How many ways are there of doing this? many ways are there of doing this? c. There are five spies. Choose one to go to Miami and another to go to c. There are five spies. Choose one to go to Miami and another to go to Watertown. Q: How many ways can we do this? Watertown. Q: How many ways can we do this? Permutations d. Same as above, but choose a 3rd to go to Kalamazoo. Permutations d. Same as above, but choose a 3rd to go to Kalamazoo. e.Q: How many permutations are there of r objects selected from a set of size n. e.Q: How many permutations are there of r objects selected from a set of size n. 2018-09-06 (Notation: P(r, n).) 2018-09-06 (Notation: P(r, n).) v How many permutations of v There are four spies. We choose v There are five spies. Choose one to go to Miami and another to go to Water- f a, b, c g are there? one a pilot and another as co-pilot. town. Question: How many ways are there of doing this? An answer: Question: How many ways are An answer: 5 · 4 = 20. there of doing this? • There are 3 choices for the 1st v Same setup as above, but choose a 3rd to go to Kalamazoo. Question: How letter. An answer: many ways are there of doing this? An answer: 5 · 4 · 3 = 60. • There are 2 choices for the • There are 4 choices for the 1st 2nd letter. spy. v Question: How many permutations are there of r objects selected from a set of size n. • There is 1 choice for the 3rd • There are 3 choices for the n! An answer: P(r, n) = n · (n − 1) · ... · (n − r + 1) = . letter. 2nd spy. (n − r)! • By the Mult. principle, there • By the Mult. principle, there are a total of 3 · 2 · 1 = 6 are a total of 4 · 3 = 12 choices. choices. Combinations Poly. Ciphers Definition 3. a. A combination is a selection of r objects from a size-n set. Combinations (We don’t worry about order.) b.C (n, r) = (n) = n! = 1 · P(n, r). Counting r r!(n−r)! r! = The number of ways of selecting (choosing) r objects from a set of size n is: Puzzles Combinations Suppose a lottery ticket contains 6 numbers from the set f 0, . , 39 g. a. How many tickets are possible when orders matters? Definition 3. 2018-09-06 b. How many when order doesn’t matter? a. A combination is a selection of r objects from a size-n set. Suppose a lottery ticket contains 6 numbers from the set f 0, . , 39 g. (We don’t worry about order.) a. How many tickets are possible when orders matters? ( ) = (n) = n! = 1 · ( ) b.C n, r r r!(n−r)! r! P n, r . P(6, 40) = 2763633600. = The number of ways of selecting (choosing) r b. How many when order doesn’t matter? objects from a set of size n C(6, 40) = 3838380. is: Puzzles Suppose a lottery ticket contains 6 numbers from the set f 0, . , 39 g. a. How many tickets are possible when orders matters? b. How many when order doesn’t matter? Probability Basic Properties of Probability Definition 4. a. Sample space: the possible outcomes of an experiment E.g.: Rolls of a six-sided die = 1, 2, 3, 4, 5, 6 b. Event: a subset of a sample space I :E = f x 2 S x 2/ E g. p(:E) = 1 − p(E). E.g.: Even rolls of a six-sided die = 2, 4, 6 I !! In this course, sample spaces are usually finite. I For all E, 0 ≤ p(E) ≤ 1. I If E and F are events of S, then To determine the probability of an event in a finite sample space, S: p(E [ F) = p(E) + p(F) − p(E \ F). E.g.: Roll of a fair die. 1. Determine the elements of S !!! Computing p(E \ F) can be tricky. a.p (rolling an odd #) = 1/2. 2. S 3 Assign a weight to each element of b.p (rolling a prime) = 1/2. (a) each weight is ≥ 0 and ( ) = (b) the weights sum to 1. c.p rolling an odd prime 1/3. 3. Probability of E = ∑a2E weight(a). Independence Back to Ciphers Definition 5. The problem with the monoalphabetic ciphers is that the frequency of characters is Suppose E, F ⊆ S. unchanged. a.E and F are independent iff p(E \ F) = p(E) · p(F). b.E F p(E \ F) 6= p(E) · p(F) and are dependent iff . Vigerere` Cipher c. If an experiment is repeated in n independent trials Plaintext = mollywillneverbreakthis.