Fall 2017 September 20, Written Homework 02

Similar documents
Math.3336: Discrete Mathematics. Mathematical Induction

Fall 2017 November 10, Written Homework 5

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION

CPE 776:DATA SECURITY & CRYPTOGRAPHY. Some Number Theory and Classical Crypto Systems

Homework #2 solutions Due: June 15, 2012

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

CPSC 467: Cryptography and Computer Security

Public Key Cryptography

Discrete Mathematics GCD, LCM, RSA Algorithm

Summer 2017 June 16, Written Homework 03

Number Theory. Modular Arithmetic

COMP424 Computer Security

Introduction to Public-Key Cryptosystems:

ECE 646 Lecture 5. Mathematical Background: Modular Arithmetic

CPSC 467b: Cryptography and Computer Security

Number Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers

Discrete mathematics I - Number theory

Cryptography. pieces from work by Gordon Royle

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague 27 October, CS1800 Discrete Structures Midterm Version A

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Number theory (Chapter 4)

CS483 Design and Analysis of Algorithms

Numbers. Çetin Kaya Koç Winter / 18

Number theory (Chapter 4)

Notes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I

ICS141: Discrete Mathematics for Computer Science I

Number Theory Notes Spring 2011

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

Encryption: The RSA Public Key Cipher

Integers and Division

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

Solutions to the Midterm Test (March 5, 2011)

Mathematical Foundations of Cryptography

17.1 Binary Codes Normal numbers we use are in base 10, which are called decimal numbers. Each digit can be 10 possible numbers: 0, 1, 2, 9.

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

Lemma 1.2. (1) If p is prime, then ϕ(p) = p 1. (2) If p q are two primes, then ϕ(pq) = (p 1)(q 1).

MATH 145 Algebra, Solutions to Assignment 4

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer.

CHALMERS GÖTEBORGS UNIVERSITET. TDA352 (Chalmers) - DIT250 (GU) 11 April 2017, 8:30-12:30

Introduction to Cybersecurity Cryptography (Part 5)

Clock Arithmetic and Euclid s Algorithm

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

10 Public Key Cryptography : RSA

Solution to Midterm Examination

Math 430 Midterm II Review Packet Spring 2018 SOLUTIONS TO PRACTICE PROBLEMS

University of Regina Department of Mathematics & Statistics Final Examination (April 21, 2009)

The Euclidean Algorithm and Multiplicative Inverses

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

Basic elements of number theory

Basic elements of number theory

CS1800 Discrete Structures Fall 2016 Profs. Gold & Schnyder April 25, CS1800 Discrete Structures Final

Public Key Algorithms

Simple Math: Cryptography

Public Key Encryption

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

Number Theory and Group Theoryfor Public-Key Cryptography

Number Theory Proof Portfolio

Cryptography. P. Danziger. Transmit...Bob...

Asymmetric Cryptography

Chapter 4 Asymmetric Cryptography

Math 299 Supplement: Modular Arithmetic Nov 8, 2013

Homework Problems, Math 134, Spring 2007 (Robert Boltje)

Elementary Number Theory MARUCO. Summer, 2018

Iterated Encryption and Wiener s attack on RSA

CS2800 Questions selected for fall 2017

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

Ma/CS 6a Class 4: Primality Testing

2 Elementary number theory

Homework 4 for Modular Arithmetic: The RSA Cipher

MODULAR ARITHMETIC KEITH CONRAD

Implementation Tutorial on RSA

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

Introduction to Number Theory

HOMEWORK 11 MATH 4753

Introduction. What is RSA. A Guide To RSA by Robert Yates. Topics

Introduction to Number Theory

A Few Facts from Number Theory and the RSA Cryptosystem OVERVIEW. RSA Producing Big Primes. Table of Contents. Overview Basic Facts of Number Theory

Algorithms (II) Yu Yu. Shanghai Jiaotong University

Number Theory A focused introduction

MATH 361: NUMBER THEORY FOURTH LECTURE

MATHEMATICS EXTENDED ESSAY

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

19. Coding for Secrecy

CSC 474 Information Systems Security

NOTES ON SIMPLE NUMBER THEORY

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

Know the meaning of the basic concepts: ring, field, characteristic of a ring, the ring of polynomials R[x].

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives

Mathematical Foundations of Public-Key Cryptography

Chapter 5. Number Theory. 5.1 Base b representations

Outline. Some Review: Divisors. Common Divisors. Primes and Factors. b divides a (or b is a divisor of a) if a = mb for some m

Outline. AIT 682: Network and Systems Security. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms

Lecture 3.1: Public Key Cryptography I

Security II: Cryptography exercises

Implementation of the RSA algorithm and its cryptanalysis. Abstract. Introduction

2. Cryptography 2.5. ElGamal cryptosystems and Discrete logarithms

CS1800 Discrete Structures Final Version A

Transcription:

CS1800 Discrete Structures Profs. Aslam, Gold, & Pavlu Fall 2017 September 20, 2017 Assigned: Wed 20 Sep 2017 Due: Fri 06 Oct 2017 Instructions: Written Homework 02 The assignment has to be uploaded to Blackboard by the due date. NO assignment will be accepted after 11:59pm on that day. We expect that you will study with friends and often work out problem solutions together, but you must write up your own solutions, in your own words. Cheating will not be tolerated. Professors, TAs, and peer tutors will be available to answer questions but will not do your homework for you. One of our course goals is to teach you how to think on your own. You may turn in work to Blackboard that is either handwritten and scanned, written in a word processor such as Word, or typeset in LaTeX. In the case of handwritten work, we may deduct points if the scan is upside down or the work is illegible. To get full credit, show INTERMEDIATE steps leading to your answers, throughout. Problem 1 [18 pts; (6,6,6)]: Prime Factorization and Euclid s Algorithm Compute the following. Show all of your work. i. gcd(6000, 1280) using prime factorization. ii. gcd(1275, 135) using Euclid s algorithm. iii. lcm(364, 260) by first computing the gcd using Euclid s algorithm. Solution: i. gcd(6000, 1280) = gcd(6 10 3, 2 7 10) = gcd(2 4 3 5 3, 2 8 5) = 2 4 5 = 80 ii. gcd(1275, 135) = gcd(135, 1275 mod 135) = gcd(135, 60) = gcd(60, 135 mod 60) = gcd(60, 15) = gcd(15, 60 mod 15) = gcd(15, 0) = 15 1

iii. gcd(364, 260) = gcd(260, 364 mod 260) = gcd(260, 104) = gcd(104, 260 mod 104) = gcd(104, 52) = gcd(52, 104 mod 52) = gcd(52, 0) = 52 364 260 = gcd(364, 260) lcm(364, 260) lcm(364, 260) = 364 260 gcd(364, 260) = 364 260 52 = 1820 Problem 2 [24 pts; (6,6,6,6)]: A New Algorithm for Computing GCD Given two positive integers a and b, a b, Euclid s algorithm computes the gcd of a and b by reducing the problem to that of computing the gcd of b and (a mod b), where a mod b is often much smaller than a. Thus the algorithm rapidly converges to a final result. While the calculation of a mod b is not hard, it requires division by arbitrary values of b which can be difficult to perform mentally and which can be computationally expensive for simple computing devices. As we saw in the context of converting to and from binary numbers, multiplying and dividing by 2 is much simpler mentally (and, as it turns out, computationally). Consider the following alternative algorithm for gcd using only subtraction and division by 2, developed below through a series of exercises. i. Prove that if a and b are both even, then gcd(a, b) = 2 gcd(a/2, b/2). ii. Prove that if a is even and b is odd, then gcd(a, b) = gcd(a/2, b). (Similarly, if a is odd and b is even, then gcd(a, b) = gcd(a, b/2).) iii. Prove that if a and b are both odd, then gcd(a, b) = gcd((a b)/2, b). Hint: Use the fact that gcd(a, b) = gcd(a b, b) and an earlier fact you have proven. If a and b are both odd, what is true of a b? iv. Apply the above three claims repeatedly to compute the following: gcd(294, 210) gcd(464, 88) Show your work. 2

Solution: i. Any even number is divisible by 2. If a and b are both even numbers, then 2 is a common divisor for a and b: gcd(a, b) = gcd(2 a 2, 2 b 2 ) = 2 gcd(a/2, b/2). ii. If a is even and b is odd, then 2 is a divisor of a, but not a divisor of b; therefore 2 is not a common divisor of a and b: gcd(a, b) = gcd(a/2, b). iii. Let us consider that a b. We have that gcd(a, b) = gcd(a b, b). Since a and b are both odd, a b must be even. We now have a b even and b odd, so our result from part ii applies, yielding gcd(a, b) = gcd(a b, b) = gcd((a b)/2, b). iv. gcd(294, 210) = 2 gcd(147, 105) = 2 gcd(21, 105) = 2 gcd(42, 21) = 2 gcd(21, 21) = 2 gcd(0, 21) = 2 21 = 42 gcd(464, 88) = 2 gcd(232, 44) = 2 2 gcd(116, 22) = 2 2 2 gcd(58, 11) = 2 2 2 gcd(29, 11) = 2 2 2 gcd(9, 11) = 2 2 2 gcd(1, 9) = 2 2 2 1 = 8 Problem 3 [38 pts; (2,4,4,8,8,8,2,2)]: Linear Ciphers At an archeological dig, you recover a set of documents. Linguists who have studied the documents believe that they have been encrypted. Furthermore, since the site is thousands of years old, the source language is unknown and certainly not English. Your job is to decrypt what appears to be an important passage contained in the documents, determine the source language, and translate the original text into English. Linguists analyzing the documents have determined that the source language uses the familiar 26 English letters, which are encoded and decoded using the numbers {0,..., 25} in the usual way. 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 3

Based on evidence found at the site, you suspect that the documents were encrypted using a linear encryption scheme with m = 15 and k = 9. The linguists are particularly interested in decrypting and determining the source language and translation of the following passage which appears throughout the documents: clnrwcl cztnzhxt i. Encode each letter in the above phrase in the usual way, i.e., c 2, l 11, n 13, and so on. ii. Since you suspect that these values were encrypted using the function num (15 num + 9) mod 26 you must subtract 9 (mod 26) and then multiply by the multiplicative inverse of 15 (mod 26) in order to decrypt these values. Start by subtracting 9 (mod 26). To compute the multiplicative inverse of an integer a, mod n, we must find an integer b, 0 < b < n, such that a b 1 (mod n). One can solve for b in a number of ways. One method is to use the Extended Euclidean Algorithm, as discussed in class and described in the text. In what follows, we describe another method based on modular exponentiation. For any positive integer n, the Euler totient function ϕ(n) is defined to be the number of positive integers less than n that are relatively prime to n; in other words, it is the number of integers less than n that share no common factors with n. For example, ϕ(10) = 4 since the integers 1, 3, 7, and 9 are relatively prime to 10. The Euler totient function can be computed in a number of ways without having to list all possible integers less than n and check whether they are relatively prime to n; perhaps the simplest formula is the following ϕ(n) = n ( 1 1 ) p = n p n (1 1p1 ) (1 1p2 ) (1 1pk ) where p i are the prime factors of n. For example, the prime factors of 10 are 2 and 5; thus, we have ( ϕ(10) = 10 1 1 ) ( 1 1 ) 2 5 = 10 (1/2) (4/5) = 4 which is correct, as we saw above. This formula works in a manner similar to the Sieve of Eratosthenes: Since 2 is a factor of 10, every even number (i.e., multiples of 2 ) will share a factor with 10; thus, we can eliminate half the integers less than 10, resulting in the (1 1/2) factor in the formula above; furthermore, since 5 is a factor of 10, we can eliminate every fifth integer (i.e., the multiples of 5 ), resulting in the (1 1/5) factor; and so on. iii. Compute ϕ(26) using the method described above. 4

The Euler totient function is useful in computing the multiplicative inverses of integers a (mod n) due to the following mathematical fact, known as Euler s Theorem. a ϕ(n) 1 (mod n) How is this result useful? Since a ϕ(n) = a a ϕ(n) 1, we have a a ϕ(n) 1 1 (mod n) and thus, a ϕ(n) 1 mod n is the multiplicative inverse of a (mod n). Note that to compute a ϕ(n) 1 mod n efficiently, one would use the method for modular exponentiation described in class and in the text. iv. Compute the multiplicative inverse of 15 (mod 26) using the method described above. v. Now verify that your answer above is correct by computing the multiplicative inverse of 15 (mod 26) using the Extended Euclidean Algorithm. vi. Given the multiplicative inverse of 15, you can now complete the decryption you started in part ii above. Decrypt each encoded character by inverting the linear encryption. vii. Decode these values in the usual way to obtain a phrase in the unknown source language. viii. Conduct some research on the web to see if you can determine what this phrase means. (Try typing the decrypted words or the entire phrase into Google.) What is the English translation of this phrase? What is the source language of the documents? Solution: i. Encoded: 2 11 13 17 22 2 11 2 25 19 13 25 7 23 19 ii. Subtract 9 (mod 26): 19 2 4 8 13 19 2 19 16 10 4 16 24 14 10 ( iii. ϕ(26) = 26 1 1 ) ( 1 1 ) = 26 1 2 13 2 12 13 = 12 iv. We need to compute 15 11 mod 26. To do so, we will use fast exponentiation, computing 15 1, 15 2, 15 4, 15 8, and then 15 11 = 15 8 15 2 15 1, all mod 26. 5

15 1 mod 26 = 15 15 2 mod 26 = 225 mod 26 = 17 15 4 mod 26 = ( (15 2 mod 26) (15 2 mod 26) ) mod 26 = (17 17) mod 26 = 289 mod 26 = 3 15 8 mod 26 = ( (15 4 mod 26) (15 4 mod 26) ) mod 26 = (3 3) mod 26 = 9 mod 26 = 9 15 11 mod 26 = (15 8 15 2 15 1 ) mod 26 = (9 17 15) mod 26 = ((9 17) 15) mod 26 = (153 15) mod 26 = ((153 mod 26) (15 mod 26)) mod 26 = (23 15) mod 26 = 345 mod 26 = 7 v. Applying the Extended Euclidean Algorithm, we have: gcd(26, 15) : 26 = 1 15 + 11 11 = 26 1 15 gcd(15, 11) : 15 = 1 11 + 4 4 = 15 1 11 gcd(11, 4) : 11 = 2 4 + 3 3 = 11 2 4 gcd(4, 3) : 4 = 1 3 + 1 1 = 4 1 3 gcd(3, 1) : 3 = 3 1 + 0 The remainder is zero, so the GCD is 1, as expected. Back-substituting to determine Bezout s Identities: gcd(4, 3) : 1 = 1 4 + 1 3 gcd(11, 4) : 1 = 1 11 + 3 4 gcd(15, 11) : 1 = 3 15 + 4 11 gcd(26, 15) : 1 = 4 26 + 7 15 Thus, 7 is the multiplicative inverse of 15 (mod 26). vi. Multiply by 7 (mod 26): 3 14 2 4 13 3 14 3 8 18 2 8 12 20 18 6

vii. Decoded: docendo discimus viii. The source language is Latin, and the phrase translates to by teaching, we learn. Problem 4 [20 pts]: The RSA cryptosystem. Decipher the following message to get the initials of an organization: 8 8 17 2 Each letter is encoded using the same 0 25 scheme as the previous problem, then individually encrypted in RSA with public key (e = 23, n = 55). For example, the message HEY will be encoded and encrypted as follows. The letter H corresponds to 7, and 7 23 mod 55 equals 13. The letter E corresponds to 4, and 4 23 mod 55 equals 9. The letter Y corresponds to 24, and 24 23 mod 55 equals 19. So the message HEY, when encoded and encrypted, reads as follows. 13 9 19 Solve for the private key d, then decrypt and decode the 8 8 17 2 message. What initials do you find? Remember to show all your work. Solution: The factors of 55 are 5 and 11, so ϕ(n) = 4 10 = 40. Given the encryption exponent e = 23, to find the private key d, we need to determine the multiplicative inverse of 23 (mod 40). This can be accomplished via the Extended Euclidean Algorithm or the method described in Problem 3 above. The result is d = 7. Now that we have d, decryption is straightforward via (fast) exponentiation: 8 7 mod 55 = 2 = C 8 7 mod 55 = 2 = C 17 7 mod 55 = 8 = I 2 7 mod 55 = 18 = S The message is the initials of our home college, CCIS. 7