Scrambling Frequences ◮ To get around the weakness of monoalphabetic ciphers, we need to somehow scramble letter frequences. Polyalphabetic and Polygraphic Ciphers ◮ 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 = { 00, 01, 02, . . . , 99 } = two digit strings. ➤ Define a map a i �→ S i , a subset of S ∋ Intro. to Cryptography ◮ S 0 , . . . , S 25 are a partition of S . ◮ (freq. of a i ) ≈ � S i � / � S � . September 6, 2018 So ‘e’ will have about 12 different codes, but ‘x’ will have just one. ➤ When encoding a i pick a random element of S i . ➤ 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, § 3-1) The Multiplication Principle (Andrews, § 3-1) If task 1 can be done p 1 ways and If task 1 can be done p 1 ways and task 2 can be done p 2 ways and task 2 can be done p 2 ways and . . . . . . task k can be done p k ways, task k can be done p k 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 p 1 × p 2 × · · · × p k p 1 × p 2 × · · · × p k Sample Problems Sample Problems How many different 4-letter radio station call letters How many different 4-letter radio station call letters Answers 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, § 3-1) If task 1 can be done p 1 ways and task 2 can be done p 2 ways and . . . How many are there of: task k can be done p k ways, then the total number of ways of doing all k tasks is a. license plates with three letters followed by four digits? p 1 × p 2 × · · · × p k 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 2018-09-06 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 Definition 2. The “multiplication principle” is some times called 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) a. Q: How many permutations of { a , b , c } are there? How many are there of: b. There are four spies. We choose one a pilot and another as co-pilot. Q: How a. license plates with three letters followed by four digits? 26 · 26 · 26 · 10 · 10 · 10 · 10 = 26 3 · 10 4 = 175760000 many ways are there of doing this? c. There are five spies. Choose one to go to Miami and another to go to b. license plates as before, but no repeated letters? 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 Poly. Ciphers Definition 2. Definition 2. 2018-09-06 2018-09-06 A permutation is an ordering of a set of objects. A permutation is an ordering of a set of objects. Counting Counting Puzzles Puzzles a. Q: How many permutations of { a , b , c } are there? a. Q: How many permutations of { a , b , c } 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 Permutations Watertown. Q: How many ways can we do this? Permutations Watertown. Q: How many ways can we do this? d. Same as above, but choose a 3rd to go to Kalamazoo. 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 . (Notation: P ( r , n ) .) (Notation: P ( r , n ) .) ❖ How many permutations of ❖ There are four spies. We choose ❖ There are five spies. Choose one to go to Miami and another to go to Water- { a , b , c } are there? town. Question: How many ways are there of doing this? one a pilot and another as co-pilot. Question: How many ways are An answer: 5 · 4 = 20. An answer: there of doing this? ❖ Same setup as above, but choose a 3rd to go to Kalamazoo. Question: How • There are 3 choices for the 1st many ways are there of doing this? An answer: letter. An answer: 5 · 4 · 3 = 60. • There are 4 choices for the 1st • There are 2 choices for the spy. ❖ Question: How many permutations are there of r objects selected from a set 2nd letter. of size n . • There are 3 choices for the • There is 1 choice for the 3rd n ! An answer: P ( r , n ) = n · ( n − 1 ) · . . . · ( n − r + 1 ) = ( n − r ) !. 2nd spy. letter. • By the Mult. principle, there • By the Mult. principle, there are a total of 4 · 3 = 12 are a total of 3 · 2 · 1 = 6 choices. choices. Combinations Poly. Ciphers Combinations Definition 3. 2018-09-06 a. A combination is a selection of r objects from a size- n set. Counting (We don’t worry about order.) ( n n ! 1 b. C ( n , r ) = r ) = = r ! · P ( n , r ) . r ! ( n − 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 { 0, . . . , 39 } . a. How many tickets are possible when orders matters? Definition 3. 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 { 0, . . . , 39 } . (We don’t worry about order.) a. How many tickets are possible when orders matters? ( n n ! 1 b. C ( n , r ) = r ) = = r ! · P ( n , r ) . P ( 6, 40 ) = 2763633600. r ! ( n − r ) ! = 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 { 0, . . . , 39 } . 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 = ◮ ¬ E = { x ∈ S x / ∈ E } . b. Event: a subset of a sample space ✷ , ✹ , ✻ ◮ p ( ¬ E ) = 1 − p ( E ) . � � E.g.: Even rolls of a six-sided die = ◮ For all E , 0 ≤ p ( E ) ≤ 1. !! In this course, sample spaces are usually finite. ◮ If E and F are events of S , then To determine the probability of an event p ( E ∪ F ) = p ( E ) + p ( F ) − p ( E ∩ F ) . in a finite sample space, S : E.g.: Roll of a fair die. !!! Computing p ( E ∩ F ) can be tricky. 1. Determine the elements of S a. p ( rolling an odd # ) = 1/2. 2. Assign a weight to each element of S ∋ b. p ( rolling a prime ) = 1/2. (a) each weight is ≥ 0 and c. p ( rolling an odd prime ) = 1/3. (b) the weights sum to 1. 3. Probability of E = ∑ a ∈ E 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 and F are dependent iff p ( E ∩ F ) � = p ( E ) · p ( F ) . Viger` ere Cipher c. If an experiment is repeated in n independent trials Plaintext = mollywillneverbreakthis. Key = chaos. & if the probability of an event E is p , then the expected number of events (Exp ( E ) ) is p · n . m o l l y w i l l + c h a o s c h a o Examples: Flipping a coin 5 times, S = { HHHHH , . . . , TTTTT } . O V L Z Q T P L Z p ( no heads ) = 1/32 ( 1 head ) = 5/32 - c h a o s c h a o p ( 2 heads ) = 10/32 p ( 3 heads ) = 10/32 m o l l y w i l l p ( 4 heads ) = 5/32 p ( 5 heads ) = 1/32 Expected. num. of heads = 1 2 · 5 = 2.5. ← how to interp.?
Recommend
More recommend