NUMBER THEORY FOR CRYPTOGRAPHY

Size: px
Start display at page:

Download "NUMBER THEORY FOR CRYPTOGRAPHY"

Transcription

1 1 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 1 INSTITÚID TEICNEOLAÍOCHTA CHEATHARLACH INSTITUTE OF TECHNOLOGY CARLOW NUMBER THEORY FOR CRYPTOGRAPHY Contents 1 Number Theory for Cryptography Linear Diophantine Equation Linear Congruences Primes and Prime Factorization The Euler Phi Function Some Special Congruences Public-Key Cryptography The RSA Algorithm Digital Signatures Diffe-Hellman Key Exchange The Knapsack Cryptosystem

2 2 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 2 1 Number Theory for Cryptography Theorem 1 Let a and b be integers, not both zero. Then a and b are relatively prime if and only if there exists integers x and y such that ax + by = 1 Theorem 2 If gcd(a,b)=d, then ( a gcd d, b ) = 1 d Theorem 3 If a c and b c, with gcd(a,b)=1, then ab c. Theorem 4 (Euclid theorem) If a bc, with the gcd(a,b)=1, then a c. 1.1 Linear Diophantine Equation A Diophantine equation is any equation in one or more unknowns which is to be solved in the integers. The simplest type of Diophantine equation is the linear Diophantine equation in two unknowns (which we will consider): ax + by = c where a, b, c are integers and a, b not both zero. A solution of this equation is a pair of integers x 0, y 0 which, when substituted into the equation, satisfy it i.e., ax 0 + by 0 = c The name honors the mathematician Diophantus who initiated the study of such equations around 250 AD.

3 3 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 3 Theorem 5 The linear Diophantine equation ax + by = c has a solution if and only if gcd(a, b) c If x 0, y 0 is any particular solution of this equation, then all other solutions are given by x = x 0 + t. b d y = y 0 t. a d where d = gcd(a, b) and t Z. Proof To establish the second assertion of the theorem, let us suppose that a solution x 0, y 0 of the given equation is known. If x, y is any other solution, then ax 0 + by 0 = c = ax + by which is equivalent to a(x x 0 ) = b(y 0 y) From theorem 2 there exists relatively prime integers r and s such that a = dr, b = ds. Substituting these values into the last written equation and canceling the common factor d, we find that r(x x 0 ) = s(y 0 y) We now have that r s(y 0 y) with gcd(r, s) = 1. Using Euclid s theorem, it must be the case that r (y 0 y), or in other words, y 0 y = rt for some integer t. Substituting we obtain This leads us to the formulas x x 0 = st x = x 0 + st = x 0 + t. b d y = y 0 rt = y 0 t. a d where d = gcd(a, b) and t Z.

4 4 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 4 It is easy to see that these values satisfy the Diophantine equation, regardless of the choice of the integer t since ( ax + by = a x 0 + t. b ) d = (ax 0 + by 0 ) + = c + 0.t = c ( + b y 0 t. a d ) ( ab d ab ) t d Thus there are infinitely many solutions of the given equation, one for each value of t. Example Consider the linear Diophantine equation 172x + 20y = 1000 Applying Euclid s Algorithm to the evaluation of gcd(172, 20), we find that 172 = 8(20) = 1(12) = 1(8) = 2(4) + 0 Hence gcd(172, 20) = 4. Since , a solution to this equation exists. To obtain the integer 4 as a linear combination of a = 172 and b = 20, we work backwards through the above calculation as follows: a = 8b = a 8b b = a 8b = 9b a a 8b = 9b a = 2a 17b Multiplying * by 250 yields 500a 4250b = 1000 Comparing this equation with the equation we are asked to solve yields an initial solution x 0 = 500 and y 0 = All other solutions are expressed by x = t y = t for some t Z.

5 5 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 5 Note If asked to produce all positive integer solutions to the equation, if any exists, we must determine t such that x > 0 and y > 0. If 5t > 0 then t > 100. If t > 0 then t < Since t must be an integer, we are forced to conclude that t = 99. t > 100 t < Thus our Diophantine equation has a unique positive solution x = 5, y = 7 corresponding to the value t = 99. Example Consider the linear Diophantine equation 578x + 832y = Applying Euclid s Algorithm to the evaluation of gcd(578, 832), we find that 832 = 1(578) = 2(254) = 3(70) = 1(44) = 1(26) = 1(18) = 2(8) = 4(2) + 0 Hence gcd(578, 832) = 2. Since , a solution to this equation exists. To obtain the integer 4 as a linear combination of a = 578 and b = 832, we work backwards through the above calculation as follows: b = a = a + b a = 2(b a) = 3a 2b b a = 3(3a 2b) = 10a + 7b 3a 2b = 10a + 7b = 13a 9b 7b 10a = 13a 9b = 23a + 16b 13a 9b = 23a + 16b = 36a 25b 23a + 16b = 2(36a 25b) = 95a + 66b

6 6 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 6 Multiplying * by 7466 yields 7466(66b) 7466(95a) = Comparing this equation with the equation we are asked to solve yields an initial solution x 0 = 7466(95) and y 0 = 7466(66). All other solutions are expressed by x = 95(7466) + 416t y = 66(7466) 289t for some t Z. Exercise 1. Determine all solutions in the integers (the general solution) of the following Diophantine equation 1521x + 632y = Determine all solutions in the positive integers of the following Diophantine equation 123x + 360y = Linear Congruences We consider linear congruences and their solution because of the importance they hold in cryptography. Definition Let a, b, n Z with n > 0. An equation of the form ax b(mod n) is called a linear congruence and the solution of such an equation is an integer x 0 such that ax 0 b(mod n). Note If x 0 is a solution of ax b(mod n) and if x 1 x 0 (mod n) then ax 1 ax 0 b(mod n) so x 1 is also a solution. Hence, if one member of a congruence class modulo n is a solution, then all members of this class are solutions.

7 7 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 7 The following theorem will allow us decide if a linear congruence has a solution and furthermore tell how many congruence classes modulo n provide solutions. Theorem 6 The linear congruence ax b(mod n) has a solution if and only if gcd(a, n) b. d = gcd(a, n) and d b, then it has d distinct congruence classes modulo n as solutions. If We can easily solve linear congruences using the algebra of congruences as follows: 4x 3 13(mod 7) 4x 16(mod 7) x 4(mod 7) Hence the congruence class 4 modulo 7 provides solutions to the linear congruence 4x 3 13(mod 7). Alternatively, we could define the inverse of an integer modulo n and use an inverse to solve a linear congruence. Definition Given any integer a with gcd(a, n) = 1, a solution of is called an inverse of a modulo n. ax 1(mod n) Remark Let a 1 be the inverse of a modulo n, i.e., aa 1 1(mod n). To solve ax b(mod n) we multiply both sides by a 1 a 1 ax a 1 b(mod n) x a 1 b(mod n)

8 8 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 8 Exercise Find all solutions of the following linear congruences i 2x 5(mod 7) ii 17x 14(mod 21) iii 34x 60(mod 98) iv 36x 12(mod 102) If no solution exists, justify your answer. Remark We can solve a basic linear congruence using the algebra of congruences as outlined above. However the solution of the linear congruence ax b(mod n) is identical to the solution of the Linear Diophantine Equation ax = ny + b This is true since if ax b(mod n) n ax b ax b = yn, y Z ax = ny + b This is an important remark because we can now solve a linear congruence by converting it to its equivalent linear equation form and use the technique outlined in section 1.1. This will be our procedure when the congruence contain large integers. Example Consider the following linear congruence 128x 833(mod 1001) Converting to its equivalent linear form we get 128x 833(mod 1001) x x 833 = 1001y, y Z 128x 1001y = 833

9 9 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 9 So the equivalent linear Diophantine equation is 128x 1001y = 833 Applying Euclid s Algorithm to the evaluation of gcd(128, 1001), we find that 1001 = 7(128) = 1(105) = 4(23) = 1(13) = 1(10) = 3(3) = 1(40) + 0 Hence gcd(128, 1001) = 1. Since , a solution to this equation (linear congruence) exists. Furthermore there is just 1 congruence class modulo 1001 which provide solutions. Recall Theorem 2. To obtain the integer 1 as a linear combination of a = 128 and b = 1001, we work back through the above calculation as follows: b = 7a a = 1(b 7a) + 23 b 7a = 4(8a b) a b = 1(5b 39a) b 39a = 1(47a 6b) a 6b = 3(11b 86a) = b 7a 23 = 8a b 13 = 5b 39a 10 = 47a 6b 3 = 11b 86a 1 = 305a 37b Multiplying * by 833 yields 833(305)a 833(37)b = 833 Comparing this equation with the equation we are asked to solve yields an initial solution for x 0 as x 0 = 833(305) So the solution of the linear congruence is x 833(505)(mod 1001) x 254, 065(mod 1001) x 812(mod 1001)

10 10 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 10 Example Consider the following linear congruence 980x 1500(mod 1600) Converting to its equivalent linear form we get 980x 1500(mod 1600) x x 1500 = 1600y, y Z 980x 1600y = 1500 So the equivalent linear Diophantine equation is 980x 1600y = 1500 Applying Euclid s Algorithm to the evaluation of gcd(980, 1600), we find that 1600 = 1(980) = 1(620) = 1(360) = 1(260) = 2(100) = 1(60) = 1(40) = 2(20) + 0 Hence gcd(980, 1600) = 20. Since , a solution to this equation (linear congruence) exists. Furthermore there are 20 distinct congruence classes modulo 1600 which provide solutions. Recall Theorem 2. To obtain the integer 20 as a linear combination of a = 980 and b = 1600, we work back through the above calculation as follows: b = a a = b a b a = 2b a a b = 2b 3a b 3a = 2(5a 3b) a 3b = 8b 13a b 13a = 18a 11b = b a 360 = 2a b 260 = 2b 3a 100 = 5a 3b 60 = 8b 13a 40 = 18a 11b 20 = 19b 31a

11 11 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 11 Multiplying * by 75 yields 1425b 2325a = 1500 Comparing this equation with the equation we are asked to solve yields an initial solution for x 0 as x 0 = 2325 So a solution to the linear congruence is x 2325(mod 1600) x 875(mod 1600) In this example there are 20 congruence classes modulo 1600 that provide solutions to the linear congruence since gcd(a, n) = 20. The 20 congruence classes are given by x = t.80 where t {0, 1, 2, 3,..., 16, 17, 18, 19}. Hence x 875, 955, 1035, 1115,...(mod 1600) Note Recall that the Diophantine equation ax + by = c has a solution if and only if gcd(a, b) c. If x 0, y 0 is any particular solution of this equation, then all other solutions are given by x = x 0 + t. b d y = y 0 t. a d where d = gcd(a, b) and t Z. Similarly the linear congruence ax b(mod n) has a solution if and only if gcd(a, n) b. If x 0 is a particular solution of this congruence, then all other solutions are given as x = x 0 + t. n d where d = gcd(a, b) and t Z.

12 12 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 12 Exercise Find the general solution of the following linear congruences (by converting to their equivalent linear equation form) i 7x 4(mod 12) ii 140x 133(mod 301) iii 103x 444(mod 999) iv 987x 610(mod 1597) 1.3 Primes and Prime Factorization Definition A prime number is an integer p greater than one with the property that 1 and p are the only positive integers that divide p. P = {2, 3, 5, 7, 11, 13, 17, 19,...} Definition An integer greater than one that is not a prime number is said to be a composite number. Theorem 7 (The Fundamental Theorem of Arithmetic) Every composite number greater than one factors uniquely as a product of prime numbers. The prime number factorization from 1 to 99 is shown:

13 13 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 13 This product of primes representation is called canonical form. For example 720 = To factorise a composite number into its prime factors the method is simply to divide the given integer by the smallest prime 2 until the integer is no longer divisible by 2. Then divide by the next prime 3 until the integer is no longer divisible by 3, next divide by 5 until the integer is no longer divisible by 5... and so on, dividing by larger and larger primes until we reach 1. We can illustrate this method as follows: 720 = = = = = = Hence we have that 720 = Also, for example: 1000 = = = = = Hence we have that 1000 = Having used successive division to factorise a known composite integer into its unique prime factors, we find that his method is adequate for composite numbers of reasonable size but is not an efficient method in terms of computer time. We now consider a further method of prime factorisation - a method known as Pollard rho-factorisation.

14 14 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 14 In 1974, John Pollard proposed a method that is remarkably successful in finding moderate-sized factors (up to about 20 digits) of composite numbers that were formerly difficult to factorise. Consider a large odd integer n that is known to be composite. The first step in Pollard s factorisation method is to choose a fairly simple polynomial of degree at least 2 with integer coefficients, such as a quadratic polynomial f(x) = x 2 + a a 0, 2 Then, starting with some initial x 0, a random sequence x 1, x 2, x 3,... is created from the recursive relation x k+1 f(x k )(mod n) k = 0, 1, 2,... that is, the successive iterates x 1 = f(x 0 ), x 2 = f(f(x 0 )), x 3 = f(f(f(x 0 ))),... are computed modulo n. Now simply compare x k with earlier x j, calculating gcd(x k x j, n) until a nontrivial greatest common divisor occurs. The divisor obtained in this way is not necessarily the smallest factor of n, and indeed it may not even be prime. The possibility exists that when a greatest common divisor greater than 1 is found, it may turn out to be equal to n itself, i.e., x k x j (mod n). Although this happens only rarely, one remedy is to repeat the computation with either a new value of x 0 or a different polynomial f(x). We can illustrate the method simply with the integer n = If we choose x 0 = 1 and f(x) = x 2 + 1, the recursive sequence will be x 1 = 2, x 2 = 5, x 3 = 26, x 4 = 677, x 5 = 829,... Comparing different x k, we find that gcd(x 5 x 3, 2189) = gcd(803, 2189) = 11 and so a divisor of 2189 is 11. Hence the prime factors of 2189 = As k increases, the task of computing gcd(x k x j, n) for each j < k becomes very time consuming. We shall see that it is often more efficient to reduce the number of steps by looking at cases in which k = 2j. The following example will illustrate the method more clearly.

15 15 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 15 Example To factor n = using Pollard s method, let us take x 0 = 3 as a starting value and f(x) = x 2 1 as the polynomial. The sequence of integers that x k generates is 8, 63, 3968, 4801, 21104, 28526, 18319, 18926,... Making the comparison x 2k with x k, we get x 2 x 1 = 63 8 = 55 gcd(55, 30623) = 1 x 4 x 2 = = 4738 gcd(4738, 30623) = 1 x 6 x 3 = = gcd(24558, 30623) = 1 x 8 x 4 = = gcd(14125, 30623) = 113 The desired factorisation is = Example To factor n = 8051 using Pollard s method, let us take x 0 f(x) = x as the polynomial. The sequence of integers that x k generates is = 2 as a starting value and 5, 26, 677, 7474, 2839, 871,... Making the comparison x 2k with x k, we get x 2 x 1 = 26 5 = 21 gcd(21, 8051) = 1 x 4 x 2 = = 7448 gcd(7448, 8051) = 1 x 6 x 3 = = 194 gcd(194, 8051) = 97 The desired factorisation is 8051 = Remark The polynomial f(x) should be chosen so that the probability is high that a suitably large number of integers x i are generated before they repeat. Empirical evidence indicates that the polynomial f(x) = x performs well for this test. Furthermore the initial value x 0 = 2 is often used. This method is called the Pollard s rho-method. To understand why it is called this consider the following diagram.

16 16 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 16 x 2 = 26 x 3 = (mod 97) x 1 = 5 x 4 = (mod 97) x 0 = 3 Because this figure resembles the greek letter ρ this factoring method is popularly known as Pollard s rho-method. This diagram shows the periodic behavior of the sequence 5, 26, 677, 7474, 2839, 871,... when reduced modulo 97, with x 0 = 2 i.e. the sequence 2, 5, 26, 95, 5, 26, 95,... The part of this sequence that occurs before the periodicity is the tail of the rho (ρ), and the loop is the periodic part. It is worth observing that because x 3 x 6 95 (mod 97), the length of the period is 6 3 = 3. The Pollard s rho-method has proven to be practical for the factorization of integers with moderately large prime factors. In practice, the first attempt to factor a large integer is to do trial division by small primes, say by all primes less than 10, 000. Next, the Pollard s rho-method is used to look for prime factors of intermediate size (up to ). Only after trial division by small primes and the Pollard s rho-method have failed are the really big guns brought in, such as the quadratic sieve or the elliptic curve method. Exercise Use Pollard s rho-method to factorize the following integers: 299, 1003, 8051 Solution: 299=13.23, 1003=17.59, 8051=83.97

17 17 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY The Euler Phi Function Definition Let n be a positive integer. The Euler phi-function φ(n) is defined to be the number of positive integers not exceeding n that are relatively prime to n. The table displays the values of φ(n) for 1 n 12. n φ(n) Theorem 8 The function φ(n) is a multiplicative function. So, if m, n Z with gcd(m, n) = 1, then φ(m.n) = φ(m).φ(n) So, for example, φ(30) = φ(5).φ(6) = 4.2 = 8 Theorem 9 If p is prime, then φ(p) = p 1 Conversely, if p is a positive integer with φ(p) = p 1, then p is prime. So, if n = p.q where p and q are prime numbers, we now have φ(n) = φ(p).φ(q) = (p 1).(q 1)

18 18 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 18 Example For p = 29 and q = 53 then n = = φ(1537) = φ(29).φ(53) = (29 1).(53 1) = = 1456 There are 1456 positive integers not exceeding 1537 that are relatively prime to Theorem 10 Let p be a prime and a a positive integer. Then φ(p a ) = p a p a 1 Example For example φ(5 3 ) = = 100 φ(2 10 ) = = 512 φ(11 2 ) = = 110 Combining Theorem 8. and Theorem 9., we have the following: Theorem 11 Let n = p a1 1 pa2 2...pan n n. Then be the prime-power factorization of the positive integer ) ( φ(n) = n (1 )(1 1p1 1p ) p n Example For example ( φ(100) = φ( ) = ) (. 1 1 ) = ( φ(360) = φ( ) = ) (. 1 1 ) (. 1 1 ) = ( φ(720) = φ( ) = ) (. 1 1 ) (. 1 1 ) =

19 19 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 19 Exercise Calculate φ(1001), φ(5040), φ(36, 000) Leonard Euler ( ) 1.5 Some Special Congruences Theorem 12 (Fermat s Little Theorem) If p is prime and a is a positive integer with p a, then a p 1 1(mod p) Fermat s Little Theorem may be stated in a more general way with the requirement p a dropped. Theorem 13 If p is prime and a is a positive integer, then a p a(mod p) Remark It is important to note that the converse of Fermat s Little Theorem is not true, i.e., if a n a(mod n) for some integer a, then n need not be prime. So for example it can be shown that (mod 341) however 341 is not a prime number since 341 =

20 20 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 20 Fermat s little theorem tells us how to work with certain congruences involving exponents when the modulus is prime. But is there a theorem that allows us to work with similar congruences where the moduli is composite? The Swiss mathematician Leonhard Euler published a proof of Fermat s little theorem in In 1760, Euler managed to find a natural generalization of the congruence in Fermat s theorem that holds for composite integers. Before stating this theorem we must first define a special function used in Euler s Theorem. Theorem 14 (Euler s Theorem) If n is a positive integer and a is an integer with gcd(a, n) = 1, then a φ(n) 1(mod n) Remark The mathematician Pierre de Fermat ( ) is more recently known for his famous last theorem which is based on a simple statement relating to a property of right-angled triangles. In a right-angled triangle, the sum of the squares of the lengths of the sides containing the right angle is equal to the square of the hypothenuse; i.e. a 2 + b 2 = c 2 B c a α A C b This statement is known as Pythagoras Theorem. Three positive integers a, b and c such that a 2 +b 2 = c 2 are called Pythagorean triples. For example (3, 4, 5), (5, 12, 13), (6, 8, 10), (8, 15, 17), (9, 12, 15) are all solutions of the equation a 2 + b 2 = c 2 In the early 1600 s, Fermat, a French lawyer and mathematician posed the following question if the power of 2 in the above equation was replaced by 3 could there be found three non-zero integers a, b and c that satisfy the equation a 3 + b 3 = c 3? The same question could be asked if the power was

21 21 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 21 increased to 4 then to 5 and down to any positive integer n. a 3 + b 3 = c 3 a 4 + b 4 = c a n + b n c n Fermat stated that the no matter how hard you try you will never find integer solutions to these equations. This famous statement become known as Fermat s Last Theorem, which was not solved until 1994 by British-American mathematician Andrew Wiles. Wiles devoted seven years of his life to proving the famous theorem, which may have generated more attempts at proofs than any other theorem. Pierre de Fermat ( ) Fermat s Last Theorem states that a n + b n = c n has no non-zero integer solutions for a, b and c when n > 2. Fermat stated his theorem in 1637 when he wrote that I have a truly marvelous proof of this proposition which this margin is too narrow to contain. Today, however, we believe that Fermat had no such proof.

22 22 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY Public-Key Cryptography With the increasing quantity of digital information being stored and communicated via telephone lines, microwaves or satellites, organizations in both the public and commercial sector need to protect this information when it is being transmitted. Cryptography is the science of making communications unintelligible to all except authorized parties. In the language of cryptography, where codes are called ciphers, the information to be concealed is called plaintext. After transformation to a secret form, a message is called ciphertext. The process of converting from plaintext to ciphertext is called encryption, while the reverse process of changing from ciphertext back to plaintext is called decryption. Let A = {A, B, C, D,...} The encryption function f(x) is given as f : A A : f(a 1 a 2...a n ) = f(a 1 )f(a 2 )...f(a n ) The encryption of A is a 1 1 function of A onto itself. To encrypt a word we encrypt one letter at a time where A = 0, B = 1, C = 2, D = 3, E = 4,..., Y = 24, Z = 25 The cryptosystems we have discussed previously (year 2) are all examples of private key or symmetric cryptosystems, where the encryption and decryption keys are easily found from each other. The disadvantage of each of the cryptosystems so far is that the secret key used by the person encrypting the message must also be transmitted in order for the receiver to decrypt the message. To avoid transmitting the secret key a new type of cryptosystem, called public-key cryptosystem, was invented in the 1970 s. In this type of cryptosystem, encryption keys can be made public but in doing so certain private information is with-held (in the case of the RSA algorithm the private information is with-held by the receiver). The security of this cryptosystem is attributed to the unrealistic large amount of computer time that is required to find the decryption key from the encryption key without the private information being known. There are several widely used public-key cryptosystems. We will consider in detail the RSA algorithm however other public-key systems include the Rabin public-key system and the ElGamal public-key system. The security of these systems rests on the difficulty of two computationally difficult problems the factorization of composite integers into their prime factors and finding discrete logarithms. Although public-key cryptosystems have many advantages they are not extensively used for general purpose encryption. The reason is that encrypting and decrypting in these cryptosystems require too much time and memory on most computers, generally several orders of magnitude more than required for private-key cryptosystems. However, public-key cryptosystems are used extensively to encrypt keys for private-key cryptosystems so that the private key can transmitted securely. They are also used in a wide variety of cryptographic protocols, such as in digital signatures.

23 23 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY The RSA Algorithm The RSA algorithm, invented by Ronald Rivest, Adi Shamir and Leonard Adleman in the 1970s and patented by them in 1983, is a public-key cryptosystem similar to exponential ciphers. Recall again the Euler-phi function. The ingredients of the RSA algorithm are as follows: two primes p and q of 100 digits or more. n = pq. φ(n) = φ(p).φ(q) = (p 1).(q 1). random number e < φ(n) such that gcd(e, φ(n)) = 1. d, the inverse of e(mod φ(n)). The procedure to apply this method of cryptography is as follows. The sender and receiver make contact and agree to transmit a message using this method. The receiver chooses the primes p and q multiplies them and places the composite number n = p.q in a public directory. It is the receiver who alone knows the actual prime factors of n and does not tell anyone their value. The receiver also generates e < φ(n) such that gcd(e, φ(n)) = 1. Notice again that the receiver alone can calculate φ(n) since it is the receiver who only knows the value of p and q. So the integers n and e are placed in a public directory no other information is placed in the public directory. Now the sender takes the integers n and e from the public directory. To encrypt the message the sender will first translate the letters of the message its equivalent two digit numerical equivalent. A = 00, B = 01, C = 02, D = 03, E = 04,..., Y = 24, Z = 25 Then group the resulting numbers into blocks of length four. Ciphertext blocks are formed using C P e (mod n) Now that the ciphertext has been transmitted which was encrypted how does the receiver decode it? To decipher a ciphertext block the receiver must determine the deciphering key d such that ed 1(mod φ(n)) i.e., d is the inverse of e(mod φ(n)), which exists since gcd(e, φ(n)) = 1.

24 24 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 24 It is the receiver who alone who can determine d since it is only he\she that know the prime factors p and q that will allow φ(n) to be determined. Although the composite integer n is in the public domain the factorization of composite numbers with large prime factors is prohibitively time consuming. Note that if p and q are digits of 100 digits each the n will be a 200 digit integer. Using the fastest factorization known, thousands of years of computer time are required to factorize an integer of this size. In summary, for the RSA algorithm C P e (mod n) P laintext (P ) Ciphertext (C) primes p, q n = p.q gcd(e, φ(n)) = 1 P C d (mod n) where ed 1(mod φ(n)) Now raising C to the d th power will recover the plaintext blocks C d (P e ) d (mod n) C d P ed (mod n) Now ed 1(mod φ(n)) φ(n) ed 1 ed 1 = k.φ(n) ed = k.φ(n) + 1 Therefore C d P k.φ(n)+1 (mod n) C d (P φ(n) ) k.p (mod n) C d P (mod n)

25 25 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 25 This is due to Euler s theorem which states that if n is a positive integer and a is an integer with gcd(a, n) = 1, then a φ(n) 1(mod n) Hence the plaintext blocks are hence recovered using P C d (mod n) As we have remarked, the security of the RSA cryptosystem depends on the difficulty of factorizing large integers into their prime factors p and q. A few extra precautions should be taken in choosing the primes p and q to prevent the use of rapid techniques to factor n = pq. For example, both p 1 and q 1 should have large prime factors, gcd(p 1, q 1) should be small, and p and q should have decimal expansions differing in length by a few digits. Example Let p = 41 and q = 67 be two primes chosen by the receiver. Also φ(2747) = φ(41).φ(67) = (41 1).(67 1) = = 2640 Now the receiver places the following integers in a public directory n = 2747, e = 13 Note that gcd(e, φ(n)) = 1 The sender locates the the public keys n and e and encrypts a message using C P e (mod n) i.e. C P 13 (mod 2747) Say this cipher produced the following ciphertext How will the receiver decode the message?

26 26 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 26 He\she will decipher the cirhertext message using the congruence P C d (mod 2747) To do this the receiver must determine the deciphering key d such that ed 1(mod φ(n)) i.e., d is the inverse of e(mod φ(n)), which exists since gcd(e, φ(n)) = 1. We can do so as follows 13d 1(mod 2640) d 1 13d 1 = 2640k 13d 2640k = 1 Applying Euclid s Algorithm to the evaluation of gcd(2640, 13), we find that 2640 = 203(13) = 13(1) + 0 Hence gcd(2640, 13) = 1. Since 1 1, a solution to this equation exists. Recall theorem 1.2. To obtain the integer 1 as a linear combination of a = 2640 and b = 13, we work backwards through the above calculation as follows: a = 203b = a 203b Now a 203b = 1 Comparing this equation with the equation we are asked to solve yields an initial solution d = 203 and k = 1. So 2437 is an inverse of 13 modulo Therefore P C 2437 (mod 2747)

27 27 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 27 Now each block of four is decrypted using this congruence as follows: P (2206) 2437 (mod 2747) 617 P (0755) 2437 (mod 2747) 404 P (0436) 2437 (mod 2747) 1908 P (1165) 2437 (mod 2747) 1306 P (1737) 2437 (mod 2747) 1823 GR EE T I NG SX The plaintext message was GREETINGS Note that these calculations cannot be done on a calculator. They can be easily performed using the computer algebra software WOLFRAM ALPHA. Exercise What is the ciphertext that is produced by the RSA cipher, with public keys n = 2627 and e = 7, is used to encrypt the message LIFE IS A DREAM Exercise If the ciphertext produced by an RSA cipher, with public keys n = 2881 and e = 5, is what is the plaintext message? Exercise Aisling s public keys for the RSA is (n, e) = (65, 11). i Which two primes did Aisling use? ii Find Aisling s private (deciphering) key d. iii Sarah wishes to send the numerical message 4 to Aisling. What numerical message does Aisling receive? iv Aisling receives the numerical message 30 from Sarah.What numerical message did Sarah send?

28 28 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 28 Exercise Aisling s public keys for the RSA is (n, e) = (91, 11). i Which two primes did Aisling use? ii Find Aisling s private (deciphering) key d. iii Sarah wishes to send the numerical message 5 to Aisling. What numerical message does Aisling receive? iv Aisling receives the numerical message 4 from Sarah.What numerical message did Sarah send? Digital Signatures When we receive an electronic message, how do we know that it has come from the supposed sender? We need a digital signature that can tell us that the message must have originated with the party who supposedly send it. The RSA cryptosystem can be used to send signed messages. When signatures are used, the recipient of a message is sure that the message came from the sender, and can convince an impartial judge that only the sender could be the source of the message. This authentication is needed for electronic mail, electronic banking, and electronic stock market transactions. To see how the RSA cryptosystem can be used to send signed messages, suppose that individual i wishes to send a signed message to individual j. The first thing that individual i does to a plaintext block P is to compute S D ki (P ) P di (mod n i ) where (d i, n i ) is the decryption key for individual i, which only individual i knows. Individual i encrypts S by forming C E kj (S) S ej (mod n j ) When n j < n i, individual j splits S into blocks of size less than n j and encrypts each block using the encrypting transformation E kj. For decrypting, individual j first uses the private decrypting transformation D kj to recover S, because D kj (C) = D kj (E kj (S)) = S To find the plaintext message P, supposedly sent by individual i, individual j next uses the public encrypting transformation E ki, because

29 29 CHAPTER 4. NUMBER THEORY FOR CRYPTOGRAPHY 29 E ki (S) = E ki (D ki (P )) = P Here, we have used the identity E ki (D ki (P )) = P, which follows from the fact that because E ki (D ki (P )) (P di ) ei P diei P (mod n i ) d i e i 1(mod φ(n i ) The combination of the plaintext block P and the signed version S convinces individual j that the message actually came from individual i. Also, individual i cannot deny sending the message, because no one other than individual i could have produced the signed message S from the original message P Diffe-Hellman Key Exchange The Knapsack Cryptosystem

10 Public Key Cryptography : RSA

10 Public Key Cryptography : RSA 10 Public Key Cryptography : RSA 10.1 Introduction The idea behind a public-key system is that it might be possible to find a cryptosystem where it is computationally infeasible to determine d K even if

More information

Public Key Cryptography

Public Key Cryptography Public Key Cryptography Spotlight on Science J. Robert Buchanan Department of Mathematics 2011 What is Cryptography? cryptography: study of methods for sending messages in a form that only be understood

More information

Lecture 1: Introduction to Public key cryptography

Lecture 1: Introduction to Public key cryptography Lecture 1: Introduction to Public key cryptography Thomas Johansson T. Johansson (Lund University) 1 / 44 Key distribution Symmetric key cryptography: Alice and Bob share a common secret key. Some means

More information

Definition: For a positive integer n, if 0<a<n and gcd(a,n)=1, a is relatively prime to n. Ahmet Burak Can Hacettepe University

Definition: For a positive integer n, if 0<a<n and gcd(a,n)=1, a is relatively prime to n. Ahmet Burak Can Hacettepe University Number Theory, Public Key Cryptography, RSA Ahmet Burak Can Hacettepe University abc@hacettepe.edu.tr The Euler Phi Function For a positive integer n, if 0

More information

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).

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). 1 Background 1.1 The group of units MAT 3343, APPLIED ALGEBRA, FALL 2003 Handout 3: The RSA Cryptosystem Peter Selinger Let (R, +, ) be a ring. Then R forms an abelian group under addition. R does not

More information

Chapter 8 Public-key Cryptography and Digital Signatures

Chapter 8 Public-key Cryptography and Digital Signatures Chapter 8 Public-key Cryptography and Digital Signatures v 1. Introduction to Public-key Cryptography 2. Example of Public-key Algorithm: Diffie- Hellman Key Exchange Scheme 3. RSA Encryption and Digital

More information

CRYPTOGRAPHY AND NUMBER THEORY

CRYPTOGRAPHY AND NUMBER THEORY CRYPTOGRAPHY AND NUMBER THEORY XINYU SHI Abstract. In this paper, we will discuss a few examples of cryptographic systems, categorized into two different types: symmetric and asymmetric cryptography. We

More information

8.1 Principles of Public-Key Cryptosystems

8.1 Principles of Public-Key Cryptosystems Public-key cryptography is a radical departure from all that has gone before. Right up to modern times all cryptographic systems have been based on the elementary tools of substitution and permutation.

More information

Week 7 An Application to Cryptography

Week 7 An Application to Cryptography SECTION 9. EULER S GENERALIZATION OF FERMAT S THEOREM 55 Week 7 An Application to Cryptography Cryptography the study of the design and analysis of mathematical techniques that ensure secure communications

More information

The RSA cryptosystem and primality tests

The RSA cryptosystem and primality tests Mathematics, KTH Bengt Ek November 2015 Supplementary material for SF2736, Discrete mathematics: The RSA cryptosystem and primality tests Secret codes (i.e. codes used to make messages unreadable to outsiders

More information

Cryptography IV: Asymmetric Ciphers

Cryptography IV: Asymmetric Ciphers Cryptography IV: Asymmetric Ciphers Computer Security Lecture 7 David Aspinall School of Informatics University of Edinburgh 31st January 2011 Outline Background RSA Diffie-Hellman ElGamal Summary Outline

More information

CIS 551 / TCOM 401 Computer and Network Security

CIS 551 / TCOM 401 Computer and Network Security CIS 551 / TCOM 401 Computer and Network Security Spring 2008 Lecture 15 3/20/08 CIS/TCOM 551 1 Announcements Project 3 available on the web. Get the handout in class today. Project 3 is due April 4th It

More information

Chapter 4 Asymmetric Cryptography

Chapter 4 Asymmetric Cryptography Chapter 4 Asymmetric Cryptography Introduction Encryption: RSA Key Exchange: Diffie-Hellman [NetSec/SysSec], WS 2008/2009 4.1 Asymmetric Cryptography General idea: Use two different keys -K and +K for

More information

Asymmetric Cryptography

Asymmetric Cryptography Asymmetric Cryptography Chapter 4 Asymmetric Cryptography Introduction Encryption: RSA Key Exchange: Diffie-Hellman General idea: Use two different keys -K and +K for encryption and decryption Given a

More information

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

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2 Contents 1 Recommended Reading 1 2 Public Key/Private Key Cryptography 1 2.1 Overview............................................. 1 2.2 RSA Algorithm.......................................... 2 3 A Number

More information

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

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya BBM 205 Discrete Mathematics Hacettepe University http://web.cs.hacettepe.edu.tr/ bbm205 Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya Resources: Kenneth Rosen,

More information

Theme : Cryptography. Instructor : Prof. C Pandu Rangan. Speaker : Arun Moorthy CS

Theme : Cryptography. Instructor : Prof. C Pandu Rangan. Speaker : Arun Moorthy CS 1 C Theme : Cryptography Instructor : Prof. C Pandu Rangan Speaker : Arun Moorthy 93115 CS 2 RSA Cryptosystem Outline of the Talk! Introduction to RSA! Working of the RSA system and associated terminology!

More information

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL NUMBER THEORY AND CODES Álvaro Pelayo WUSTL Talk Goal To develop codes of the sort can tell the world how to put messages in code (public key cryptography) only you can decode them Structure of Talk Part

More information

A Few Facts from Number Theory and the RSA Cryptosystem OVERVIEW. RSA Producing Big Primes. Table of Contents. Overview Basic Facts of 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 A Few Facts from Number Theory and the RSA Cryptosystem Larry Susanka Mathematics Department Bellevue College September 25, 2018 Table of Contents Overview Basic Facts of Number Theory The Idea of Public

More information

Public Key Algorithms

Public Key Algorithms Public Key Algorithms Raj Jain Washington University in Saint Louis Saint Louis, MO 63130 Jain@cse.wustl.edu Audio/Video recordings of this lecture are available at: http://www.cse.wustl.edu/~jain/cse571-09/

More information

Encryption: The RSA Public Key Cipher

Encryption: The RSA Public Key Cipher Encryption: The RSA Public Key Cipher Michael Brockway March 5, 2018 Overview Transport-layer security employs an asymmetric public cryptosystem to allow two parties (usually a client application and a

More information

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS Modular arithmetics that we have discussed in the previous lectures is very useful in Cryptography and Computer Science. Here we discuss several

More information

Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013

Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013 RSA Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013 Recap Recap Number theory o What is a prime number? o What is prime factorization? o What is a GCD? o What does relatively prime

More information

RSA Algorithm. Factoring, EulerPhi, Breaking RSA. Çetin Kaya Koç Spring / 14

RSA Algorithm. Factoring, EulerPhi, Breaking RSA.   Çetin Kaya Koç Spring / 14 RSA Algorithm http://koclab.org Çetin Kaya Koç Spring 2018 1 / 14 Well-Known One-Way Functions Discrete Logarithm: Given p, g, and x, computing y in y = g x (mod p) is EASY Given p, g, y, computing x in

More information

Introduction to Public-Key Cryptosystems:

Introduction to Public-Key Cryptosystems: Introduction to Public-Key Cryptosystems: Technical Underpinnings: RSA and Primality Testing Modes of Encryption for RSA Digital Signatures for RSA 1 RSA Block Encryption / Decryption and Signing Each

More information

Discrete Mathematics GCD, LCM, RSA Algorithm

Discrete Mathematics GCD, LCM, RSA Algorithm Discrete Mathematics GCD, LCM, RSA Algorithm Abdul Hameed http://informationtechnology.pk/pucit abdul.hameed@pucit.edu.pk Lecture 16 Greatest Common Divisor 2 Greatest common divisor The greatest common

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 8 February 1, 2012 CPSC 467b, Lecture 8 1/42 Number Theory Needed for RSA Z n : The integers mod n Modular arithmetic GCD Relatively

More information

Public Key 9/17/2018. Symmetric Cryptography Review. Symmetric Cryptography: Shortcomings (1) Symmetric Cryptography: Analogy

Public Key 9/17/2018. Symmetric Cryptography Review. Symmetric Cryptography: Shortcomings (1) Symmetric Cryptography: Analogy Symmetric Cryptography Review Alice Bob Public Key x e K (x) y d K (y) x K K Instructor: Dr. Wei (Lisa) Li Department of Computer Science, GSU Two properties of symmetric (secret-key) crypto-systems: The

More information

An Introduction to Cryptography

An Introduction to Cryptography An Introduction to Cryptography Spotlight on Science J. Robert Buchanan Department of Mathematics Spring 2008 What is Cryptography? cryptography: study of methods for sending messages in a form that only

More information

Cryptography. pieces from work by Gordon Royle

Cryptography. pieces from work by Gordon Royle Cryptography pieces from work by Gordon Royle The set-up Cryptography is the mathematics of devising secure communication systems, whereas cryptanalysis is the mathematics of breaking such systems. We

More information

For your quiz in recitation this week, refer to these exercise generators:

For your quiz in recitation this week, refer to these exercise generators: Monday, Oct 29 Today we will talk about inverses in modular arithmetic, and the use of inverses to solve linear congruences. For your quiz in recitation this week, refer to these exercise generators: GCD

More information

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

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p. Chapter 6 Prime Numbers Part VI of PJE. Definition and Fundamental Results Definition. (PJE definition 23.1.1) An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p. If n > 1

More information

10 Modular Arithmetic and Cryptography

10 Modular Arithmetic and Cryptography 10 Modular Arithmetic and Cryptography 10.1 Encryption and Decryption Encryption is used to send messages secretly. The sender has a message or plaintext. Encryption by the sender takes the plaintext and

More information

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

Cryptography. P. Danziger. Transmit...Bob... 10.4 Cryptography P. Danziger 1 Cipher Schemes A cryptographic scheme is an example of a code. The special requirement is that the encoded message be difficult to retrieve without some special piece of

More information

MATHEMATICS EXTENDED ESSAY

MATHEMATICS EXTENDED ESSAY MATHEMATICS EXTENDED ESSAY How does the RSA algorithm function and why is it used in modern communication? Candidate Name: Murtuza Kainan Candidate Session Number: 003077006 Word Count: 3908 1 P a g e

More information

THE RSA CRYPTOSYSTEM

THE RSA CRYPTOSYSTEM THE RSA CRYPTOSYSTEM SILVIA ROBLES Abstract. This paper explores the history and mathematics behind the RSA cryptosystem, including the idea of public key cryptosystems and number theory. It outlines the

More information

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Module No. # 01 Lecture No. # 33 The Diffie-Hellman Problem

More information

Public-Key Cryptosystems CHAPTER 4

Public-Key Cryptosystems CHAPTER 4 Public-Key Cryptosystems CHAPTER 4 Introduction How to distribute the cryptographic keys? Naïve Solution Naïve Solution Give every user P i a separate random key K ij to communicate with every P j. Disadvantage:

More information

ECE596C: Handout #11

ECE596C: Handout #11 ECE596C: Handout #11 Public Key Cryptosystems Electrical and Computer Engineering, University of Arizona, Loukas Lazos Abstract In this lecture we introduce necessary mathematical background for studying

More information

Cryptosystem. Traditional Cryptosystems: The two parties agree on a secret (one to one) function f. To send a message M, thesendersendsthemessage

Cryptosystem. Traditional Cryptosystems: The two parties agree on a secret (one to one) function f. To send a message M, thesendersendsthemessage Cryptosystem Traditional Cryptosystems: The two parties agree on a secret (one to one) function f. To send a message M, thesendersendsthemessage f(m). The receiver computes f 1 (f(m)). Advantage: Cannot

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a k for some integer k. Notation

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand 1 Divisibility, prime numbers By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a

More information

Mathematics of Cryptography

Mathematics of Cryptography UNIT - III Mathematics of Cryptography Part III: Primes and Related Congruence Equations 1 Objectives To introduce prime numbers and their applications in cryptography. To discuss some primality test algorithms

More information

Lecture Notes, Week 6

Lecture Notes, Week 6 YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPSC 467b: Cryptography and Computer Security Week 6 (rev. 3) Professor M. J. Fischer February 15 & 17, 2005 1 RSA Security Lecture Notes, Week 6 Several

More information

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

CPE 776:DATA SECURITY & CRYPTOGRAPHY. Some Number Theory and Classical Crypto Systems CPE 776:DATA SECURITY & CRYPTOGRAPHY Some Number Theory and Classical Crypto Systems Dr. Lo ai Tawalbeh Computer Engineering Department Jordan University of Science and Technology Jordan Some Number Theory

More information

A Guide to Arithmetic

A Guide to Arithmetic A Guide to Arithmetic Robin Chapman August 5, 1994 These notes give a very brief resumé of my number theory course. Proofs and examples are omitted. Any suggestions for improvements will be gratefully

More information

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost? Ch - Algorithms with numbers Addition Basic arithmetic Addition ultiplication Division odular arithmetic factoring is hard Primality testing 53+35=88 Cost? (n number of bits) O(n) ultiplication al-khwārizmī

More information

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

Notes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I Number Theory: Applications Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Fall 2007 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 3.4 3.7 of Rosen cse235@cse.unl.edu

More information

OWO Lecture: Modular Arithmetic with Algorithmic Applications

OWO Lecture: Modular Arithmetic with Algorithmic Applications OWO Lecture: Modular Arithmetic with Algorithmic Applications Martin Otto Winter Term 2008/09 Contents 1 Basic ingredients 1 2 Modular arithmetic 2 2.1 Going in circles.......................... 2 2.2

More information

Simple Math: Cryptography

Simple Math: Cryptography 1 Introduction Simple Math: Cryptography This section develops some mathematics before getting to the application. The mathematics that I use involves simple facts from number theory. Number theory is

More information

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

Number Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers Number Theory: Applications Number Theory Applications Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Results from Number Theory have many applications

More information

COMP4109 : Applied Cryptography

COMP4109 : Applied Cryptography COMP409 : Applied Cryptography Fall 203 M. Jason Hinek Carleton University Applied Cryptography Day 3 public-key encryption schemes some attacks on RSA factoring small private exponent 2 RSA cryptosystem

More information

Number Theory. Modular Arithmetic

Number Theory. Modular Arithmetic Number Theory The branch of mathematics that is important in IT security especially in cryptography. Deals only in integer numbers and the process can be done in a very fast manner. Modular Arithmetic

More information

Outline. Available public-key technologies. Diffie-Hellman protocol Digital Signature. Elliptic curves and the discrete logarithm problem

Outline. Available public-key technologies. Diffie-Hellman protocol Digital Signature. Elliptic curves and the discrete logarithm problem Outline Public-key cryptography A collection of hard problems Mathematical Background Trapdoor Knapsack Integer factorization Problem Discrete logarithm problem revisited Case of Study: The Sun NFS Cryptosystem

More information

1 The Fundamental Theorem of Arithmetic. A positive integer N has a unique prime power decomposition. Primality Testing. and. Integer Factorisation

1 The Fundamental Theorem of Arithmetic. A positive integer N has a unique prime power decomposition. Primality Testing. and. Integer Factorisation 1 The Fundamental Theorem of Arithmetic A positive integer N has a unique prime power decomposition 2 Primality Testing Integer Factorisation (Gauss 1801, but probably known to Euclid) The Computational

More information

Discrete mathematics I - Number theory

Discrete mathematics I - Number theory Discrete mathematics I - Number theory Emil Vatai (based on hungarian slides by László Mérai) 1 January 31, 2018 1 Financed from the financial support ELTE won from the Higher Education

More information

RSA Cryptosystem and Factorization

RSA Cryptosystem and Factorization RSA Cryptosystem and Factorization D. J. Guan Department of Computer Science National Sun Yat Sen University Kaoshiung, Taiwan 80424 R. O. C. guan@cse.nsysu.edu.tw August 25, 2003 RSA Cryptosystem was

More information

CRYPTOGRAPHY AND LARGE PRIMES *

CRYPTOGRAPHY AND LARGE PRIMES * CRYPTOGRAPHY AND LARGE PRIMES * B. Hartley University of Manchester, England, and National University of Singapore The word "cryptography" derives from Greek and means "secret writing". Since ancient times,

More information

Elementary Number Theory MARUCO. Summer, 2018

Elementary Number Theory MARUCO. Summer, 2018 Elementary Number Theory MARUCO Summer, 2018 Problem Set #0 axiom, theorem, proof, Z, N. Axioms Make a list of axioms for the integers. Does your list adequately describe them? Can you make this list as

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 11 February 21, 2013 CPSC 467b, Lecture 11 1/27 Discrete Logarithm Diffie-Hellman Key Exchange ElGamal Key Agreement Primitive Roots

More information

Topics in Cryptography. Lecture 5: Basic Number Theory

Topics in Cryptography. Lecture 5: Basic Number Theory Topics in Cryptography Lecture 5: Basic Number Theory Benny Pinkas page 1 1 Classical symmetric ciphers Alice and Bob share a private key k. System is secure as long as k is secret. Major problem: generating

More information

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

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory. CSS322: Security and Cryptography Sirindhorn International Institute of Technology Thammasat University Prepared by Steven Gordon on 29 December 2011 CSS322Y11S2L06, Steve/Courses/2011/S2/CSS322/Lectures/number.tex,

More information

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

CHAPTER 6. Prime Numbers. Definition and Fundamental Results CHAPTER 6 Prime Numbers Part VI of PJE. Definition and Fundamental Results 6.1. Definition. (PJE definition 23.1.1) An integer p is prime if p > 1 and the only positive divisors of p are 1 and p. If n

More information

19. Coding for Secrecy

19. Coding for Secrecy 19. Coding for Secrecy 19.1 Introduction Protecting sensitive information from the prying eyes and ears of others is an important issue today as much as it has been for thousands of years. Government secrets,

More information

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) 1 Euclid s Algorithm Euclid s Algorithm for computing the greatest common divisor belongs to the oldest known computing procedures

More information

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9.1 Chapter 9 Objectives

More information

THE RSA ENCRYPTION SCHEME

THE RSA ENCRYPTION SCHEME THE RSA ENCRYPTION SCHEME Contents 1. The RSA Encryption Scheme 2 1.1. Advantages over traditional coding methods 3 1.2. Proof of the decoding procedure 4 1.3. Security of the RSA Scheme 4 1.4. Finding

More information

Congruence of Integers

Congruence of Integers Congruence of Integers November 14, 2013 Week 11-12 1 Congruence of Integers Definition 1. Let m be a positive integer. For integers a and b, if m divides b a, we say that a is congruent to b modulo m,

More information

Ma/CS 6a Class 3: The RSA Algorithm

Ma/CS 6a Class 3: The RSA Algorithm Ma/CS 6a Class 3: The RSA Algorithm By Adam Sheffer Reminder: Putnam Competition Signup ends Wednesday 10/08. Signup sheets available in all Sloan classrooms, Math office, or contact Kathy Carreon, kcarreon@caltech.edu.

More information

Review. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm

Review. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm Review CS311H: Discrete Mathematics Number Theory Instructor: Işıl Dillig What does it mean for two ints a, b to be congruent mod m? What is the Division theorem? If a b and a c, does it mean b c? What

More information

Security Issues in Cloud Computing Modern Cryptography II Asymmetric Cryptography

Security Issues in Cloud Computing Modern Cryptography II Asymmetric Cryptography Security Issues in Cloud Computing Modern Cryptography II Asymmetric Cryptography Peter Schwabe October 21 and 28, 2011 So far we assumed that Alice and Bob both have some key, which nobody else has. How

More information

Public Key Encryption

Public Key Encryption Public Key Encryption KG October 17, 2017 Contents 1 Introduction 1 2 Public Key Encryption 2 3 Schemes Based on Diffie-Hellman 3 3.1 ElGamal.................................... 5 4 RSA 7 4.1 Preliminaries.................................

More information

RSA RSA public key cryptosystem

RSA RSA public key cryptosystem RSA 1 RSA As we have seen, the security of most cipher systems rests on the users keeping secret a special key, for anyone possessing the key can encrypt and/or decrypt the messages sent between them.

More information

Mathematical Foundations of Public-Key Cryptography

Mathematical Foundations of Public-Key Cryptography Mathematical Foundations of Public-Key Cryptography Adam C. Champion and Dong Xuan CSE 4471: Information Security Material based on (Stallings, 2006) and (Paar and Pelzl, 2010) Outline Review: Basic Mathematical

More information

ASSIGNMENT Use mathematical induction to show that the sum of the cubes of three consecutive non-negative integers is divisible by 9.

ASSIGNMENT Use mathematical induction to show that the sum of the cubes of three consecutive non-negative integers is divisible by 9. ASSIGNMENT 1 1. Use mathematical induction to show that the sum of the cubes of three consecutive non-negative integers is divisible by 9. 2. (i) If d a and d b, prove that d (a + b). (ii) More generally,

More information

Asymmetric Encryption

Asymmetric Encryption -3 s s Encryption Comp Sci 3600 Outline -3 s s 1-3 2 3 4 5 s s Outline -3 s s 1-3 2 3 4 5 s s Function Using Bitwise XOR -3 s s Key Properties for -3 s s The most important property of a hash function

More information

Ti Secured communications

Ti Secured communications Ti5318800 Secured communications Pekka Jäppinen September 20, 2007 Pekka Jäppinen, Lappeenranta University of Technology: September 20, 2007 Relies on use of two keys: Public and private Sometimes called

More information

Eindhoven University of Technology MASTER. Kleptography cryptography with backdoors. Antheunisse, M. Award date: 2015

Eindhoven University of Technology MASTER. Kleptography cryptography with backdoors. Antheunisse, M. Award date: 2015 Eindhoven University of Technology MASTER Kleptography cryptography with backdoors Antheunisse, M. Award date: 2015 Disclaimer This document contains a student thesis (bachelor's or master's), as authored

More information

Number Theory and Algebra: A Brief Introduction

Number Theory and Algebra: A Brief Introduction Number Theory and Algebra: A Brief Introduction Indian Statistical Institute Kolkata May 15, 2017 Elementary Number Theory: Modular Arithmetic Definition Let n be a positive integer and a and b two integers.

More information

Introduction to Cryptography. Lecture 8

Introduction to Cryptography. Lecture 8 Introduction to Cryptography Lecture 8 Benny Pinkas page 1 1 Groups we will use Multiplication modulo a prime number p (G, ) = ({1,2,,p-1}, ) E.g., Z 7* = ( {1,2,3,4,5,6}, ) Z p * Z N * Multiplication

More information

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPSC 467a: Cryptography and Computer Security Notes 13 (rev. 2) Professor M. J. Fischer October 22, 2008 53 Chinese Remainder Theorem Lecture Notes 13 We

More information

Math 299 Supplement: Modular Arithmetic Nov 8, 2013

Math 299 Supplement: Modular Arithmetic Nov 8, 2013 Math 299 Supplement: Modular Arithmetic Nov 8, 2013 Numbers modulo n. We have previously seen examples of clock arithmetic, an algebraic system with only finitely many numbers. In this lecture, we make

More information

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory

More information

2 More on Congruences

2 More on Congruences 2 More on Congruences 2.1 Fermat s Theorem and Euler s Theorem definition 2.1 Let m be a positive integer. A set S = {x 0,x 1,,x m 1 x i Z} is called a complete residue system if x i x j (mod m) whenever

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 9 February 14, 2013 CPSC 467b, Lecture 9 1/42 Integer Division (cont.) Relatively prime numbers, Z n, and φ(n) Computing in Z n

More information

Powers in Modular Arithmetic, and RSA Public Key Cryptography

Powers in Modular Arithmetic, and RSA Public Key Cryptography 1 Powers in Modular Arithmetic, and RSA Public Key Cryptography Lecture notes for Access 2006, by Nick Korevaar. It was a long time from Mary Queen of Scotts and substitution ciphers until the end of the

More information

RSA. Ramki Thurimella

RSA. Ramki Thurimella RSA Ramki Thurimella Public-Key Cryptography Symmetric cryptography: same key is used for encryption and decryption. Asymmetric cryptography: different keys used for encryption and decryption. Public-Key

More information

Beautiful Mathematics

Beautiful Mathematics Beautiful Mathematics 1. Principle of Mathematical Induction The set of natural numbers is the set of positive integers {1, 2, 3,... } and is denoted by N. The Principle of Mathematical Induction is a

More information

CS March 17, 2009

CS March 17, 2009 Discrete Mathematics CS 2610 March 17, 2009 Number Theory Elementary number theory, concerned with numbers, usually integers and their properties or rational numbers mainly divisibility among integers

More information

My brief introduction to cryptography

My brief introduction to cryptography My brief introduction to cryptography David Thomson dthomson@math.carleton.ca Carleton University September 7, 2013 introduction to cryptography September 7, 2013 1 / 28 Outline 1 The general framework

More information

Part IA Numbers and Sets

Part IA Numbers and Sets Part IA Numbers and Sets Theorems Based on lectures by A. G. Thomason Notes taken by Dexter Chua Michaelmas 2014 These notes are not endorsed by the lecturers, and I have modified them (often significantly)

More information

Foundations of Network and Computer Security

Foundations of Network and Computer Security Foundations of Network and Computer Security John Black Lecture #9 Sep 22 nd 2005 CSCI 6268/TLEN 5831, Fall 2005 Announcements Midterm #1, next class (Tues, Sept 27 th ) All lecture materials and readings

More information

Number Theory & Modern Cryptography

Number Theory & Modern Cryptography Number Theory & Modern Cryptography Week 12 Stallings: Ch 4, 8, 9, 10 CNT-4403: 2.April.2015 1 Introduction Increasing importance in cryptography Public Key Crypto and Signatures Concern operations on

More information

Elementary Number Theory

Elementary Number Theory Elementary Number Theory 21.8.2013 Overview The course discusses properties of numbers, the most basic mathematical objects. We are going to follow the book: David Burton: Elementary Number Theory What

More information

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

Introduction. What is RSA. A Guide To RSA by Robert Yates. Topics A Guide To RSA by Robert Yates. Topics Introduction...01/09 What is RSA...01/09 Mod-Exponentiation...02/09 Euler's Theorem...03/09 RSA Algorithm...08/09 RSA Security...09/09 Introduction Welcome to my

More information

Number Theory and Group Theoryfor Public-Key Cryptography

Number Theory and Group Theoryfor Public-Key Cryptography Number Theory and Group Theory for Public-Key Cryptography TDA352, DIT250 Wissam Aoudi Chalmers University of Technology November 21, 2017 Wissam Aoudi Number Theory and Group Theoryfor Public-Key Cryptography

More information

Mathematics of Public Key Cryptography

Mathematics of Public Key Cryptography Mathematics of Public Key Cryptography Eric Baxter April 12, 2014 Overview Brief review of public-key cryptography Mathematics behind public-key cryptography algorithms What is Public-Key Cryptography?

More information

Algorithmic Number Theory and Public-key Cryptography

Algorithmic Number Theory and Public-key Cryptography Algorithmic Number Theory and Public-key Cryptography Course 3 University of Luxembourg March 22, 2018 The RSA algorithm The RSA algorithm is the most widely-used public-key encryption algorithm Invented

More information

1 Number Theory Basics

1 Number Theory Basics ECS 289M (Franklin), Winter 2010, Crypto Review 1 Number Theory Basics This section has some basic facts about number theory, mostly taken (or adapted) from Dan Boneh s number theory fact sheets for his

More information