MTH6115 Cryptography 8.1 Primality Testing

Total Page:16

File Type:pdf, Size:1020Kb

MTH6115 Cryptography 8.1 Primality Testing MTH6115 Cryptography Notes 8: Public-key cryptography—Primes and factorisation 8.1 Primality testing Primality testing is easy, but factorisation is hard. This assertion is the basis of the security of the RSA cipher. In this section and the next, we consider it further. 8.1.1 Trial division The basic algorithm for primality testing is trial division. In a very crudep form it asserts that, if n > 1 and n is not divisible by any integer m such that 2 6 m 6 n, then n is prime. The first thing to say about this algorithm is that, with minor modification, it leads to a factorisation of n into primes. If n is not prime, then the first divisor we find will be a prime p, and we continue dividing by p while this is possible to establish the exact power of p. The quotient is divisible only by primes greater than p, so we can continue the trial divisions from the point where we left off. The second thing is that this simple algorithm does not run in polynomialp time: the input is the string of digits of n, and the number of trial divisions is about n, (very) roughly 2b=2 if n has b digits to the base 2, and roughly 10d=2 if n has d decimal digits. There are some minor improvements to the algorithm, but they do not solve the fundamental problem that the algorithm is not polynomial time. We do not need to try a potential divisor if we know it is composite;p this is because a - n implies that ab - n for all integers b. But there are about 2 n=logn primes in the required interval, which is far too many to allow the algorithm to run in polynomial time. Making sure that a potential divisor is prime (presumably by trial division) is a bad idea (it would take too long).p Also, using the Sieve of Eratosthenes (or variants) to enumerate all primes up to n is also not recommended, because of memory issues. A reasonable compromise 1 p is to divide by 2, 3 and all numbers 6k ± 1 in the required range, for about 3 n trial divisions. 1 Nevertheless, for the very smallest n, trial division is the most efficient method to prove primality. For example, if we wish to prove that an integer n 6 1680 we should pdivide it by the integers from 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 that do not exceed n. For larger n, it is probably more efficient to trial divide by some ‘small’ primes to root out composite numbers quickly, before applying a more sophisticated test. In this context, ‘small’ can mean quite a bit larger than you are used to. Also, here it would be worth making the list of ‘small’ primes we try. (Some tests may require checking that n is not divisible by some of the very smallest primes, such as 2 and 3, but it will always be advisable to use trial division somewhat beyond this.) 8.1.2 Some potentially useful results It is a bit surprising at first that primality testing can be easier than factorisation. This holds because there are algorithms which decide whether or not a number is prime without actually finding a factor if it is composite! Three examples of such theorems are given below. Theorem 34 (Fermat’s Little Theorem) If n > 1 is prime then xn ≡ x (mod n) for any integer x. Theorem 35 If n > 1 is prime and (for some integer x) x2 ≡ 1 (mod n) then x ≡ 1 or −1 (mod n). Theorem 36 (Wilson’s Theorem) An integer n > 1 is prime if and only if we have (n − 1)! ≡ −1 (mod n). We have already seen the proof of the little Fermat theorem. For the second of these we note that if p is prime and x2 ≡ 1 (mod p) then p j (x2 − 1) = (x + 1)(x − 1), and so p j (x + 1) or p j (x − 1). Here is the proof of Wilson’s Theorem. Suppose that n = p is prime. We know that every number x in the set f1;:::; p−1g has an inverse y modulo p (so that xy ≡ 1 (mod p)). The only numbers which are equal to their inverses are 1 and p − 1: for if x is equal to its inverse, then x2 ≡ 1 (mod p), and so x ≡ ±1 (mod p) (see above). The other p − 3 numbers in the range can be paired with their inverses, so that the product of each pair is congruent to 1 mod p. Now multiplying all these numbers together gives (p − 1)! ≡ 1 · 1(p−3)=2 · (p − 1) ≡ −1 (mod p): Conversely, suppose that n is composite. If q is a prime divisor of n, then certainly q divides (n − 1)!, and so (n − 1)! is congruent to a multiple of q modulo n, and so cannot be −1. (In this case, it is quite easy to show that n is a divisor of (n − 1)!, with the single exception of n = 4.) The proof of Wilson’s Theorem is not examinable. 2 Can any of these results give us a quick test for primality? Fermat’s Little Theorem gives a necessary, but not sufficient condition that n be prime. We shall say more about this in the next subsection. For Theorem 35, we note a a + that if n = 2, 4, p or 2p , where p is an odd prime and a 2 Z then x2 ≡ 1 (mod n) implies that x ≡ ±1 (mod n); if n > 1 is any other integer then this implication does not hold. We can detect whether n is even or a proper power relatively easily, and a a thus we can easily know if n has any hope of being in f2;4; p (a > 2);2p g. So we reduce to the case where n is an odd prime or has two distinct odd prime divisors. In the former case, we do not know how to show (directly and fast enough) that if x2 ≡ 1 (mod n) then x ≡ ±1 (mod n). And in the latter case, we do not know how to find (in an efficient way, even probabilistically, except if n is somewhat special) x such that x2 ≡ 1 (mod n) and x 6≡ ±1 (mod n). (The Miller–Rabin primality test makes the latter potential problem into a non-issue.) In contrast, Wilson’s Theorem gives a necessary and sufficient condition for n to be prime. That is, if (n − 1)! ≡ −1 (mod n), then n is prime; if not, then not. But nobody knows how to calculate (n − 1)! (mod n) sufficiently quickly (or even how to determine whether gcd(n;(n − 1)!) = 1 efficiently); the natural method would require n − 2 multiplications. 8.1.3 The Fermat primality test Strictly speaking this is a compositeness test: if n > 1 and you have found an x such that xn 6≡ x (mod n) then you know that n is composite, without having found any of the factors of n. If there is an x with this property, then we can reduce it modulo n to get an x with this property that satisfies xn 6≡ x (mod n). As we explained in Notes n 7, there is an efficient way to calculate x mod n, involving at most 2log2 n multipli- cations of numbers not exceeding n and calculation of the remainder modulo n after each multiplication, so each individual Fermat test is polynomial time. The possible outcomes of each Fermat test are (n is definitely) COMPOSITE if xn 6≡ x (mod n) and (n is) MAYBE PRIME if xn ≡ x (mod n). Thus, for example, 2589 ≡ 326 6≡ 2 (mod 589), and so we know that 589 is com- posite. For two larger examples, we take m = 7 · 1011 + 1 and n = 4 · 1012 + 1 and find that 2m ≡ 295817535273 6≡ 2 (mod m) and 2n ≡ 3374782511254 6≡ 2 (mod n). In none of these three cases did the test reveal a (prime) factor of the number proven to be composite. (The factorisations are 589 = 19 · 31 (very easy), 7 · 1011 + 1 = 41149 · 17011349 and 4 · 1012 + 1 = 277 · 7213 · 2002001; part of the latter factorisation stems from the algebraic identity 4X4 + 1 = (2X2 + 2X + 1)(2X2 − 2X + 1).) Unfortunately, this test doesn’t work in the other direction. For example, we have 3 2341 ≡ 2 (mod 341), even though 341 = 11 · 31 is not prime. We say that 341 is a pseudoprime to (the) base 2. Definition An integer n > 1 is a (weak or Fermat) pseudoprime to the base a if n is not prime but an ≡ a (mod n). (We really ought to specify that the integer a is at least 2, since every composite number would be a pseudoprime to the bases 0 and 1.) Any a such that an 6≡ a (mod n) is a Fermat witness (to the compositeness of n), while the other a are Fermat liars. Pseudoprimes are not very common, though it is known that there are still infinitely many of them, and if we are prepared to take the small risk that the number we chose is a pseudoprime rather than a prime, then we could simply accept such numbers. The smallest pseudoprimes to base 2 are 341, 561, 645, 1105, 1387, 1729, 1905, 2047. We could feel safer if we checked different values.
Recommended publications
  • Fast Tabulation of Challenge Pseudoprimes Andrew Shallue and Jonathan Webster
    THE OPEN BOOK SERIES 2 ANTS XIII Proceedings of the Thirteenth Algorithmic Number Theory Symposium Fast tabulation of challenge pseudoprimes Andrew Shallue and Jonathan Webster msp THE OPEN BOOK SERIES 2 (2019) Thirteenth Algorithmic Number Theory Symposium msp dx.doi.org/10.2140/obs.2019.2.411 Fast tabulation of challenge pseudoprimes Andrew Shallue and Jonathan Webster We provide a new algorithm for tabulating composite numbers which are pseudoprimes to both a Fermat test and a Lucas test. Our algorithm is optimized for parameter choices that minimize the occurrence of pseudoprimes, and for pseudoprimes with a fixed number of prime factors. Using this, we have confirmed that there are no PSW-challenge pseudoprimes with two or three prime factors up to 280. In the case where one is tabulating challenge pseudoprimes with a fixed number of prime factors, we prove our algorithm gives an unconditional asymptotic improvement over previous methods. 1. Introduction Pomerance, Selfridge, and Wagstaff famously offered $620 for a composite n that satisfies (1) 2n 1 1 .mod n/ so n is a base-2 Fermat pseudoprime, Á (2) .5 n/ 1 so n is not a square modulo 5, and j D (3) Fn 1 0 .mod n/ so n is a Fibonacci pseudoprime, C Á or to prove that no such n exists. We call composites that satisfy these conditions PSW-challenge pseudo- primes. In[PSW80] they credit R. Baillie with the discovery that combining a Fermat test with a Lucas test (with a certain specific parameter choice) makes for an especially effective primality test[BW80].
    [Show full text]
  • FACTORING COMPOSITES TESTING PRIMES Amin Witno
    WON Series in Discrete Mathematics and Modern Algebra Volume 3 FACTORING COMPOSITES TESTING PRIMES Amin Witno Preface These notes were used for the lectures in Math 472 (Computational Number Theory) at Philadelphia University, Jordan.1 The module was aborted in 2012, and since then this last edition has been preserved and updated only for minor corrections. Outline notes are more like a revision. No student is expected to fully benefit from these notes unless they have regularly attended the lectures. 1 The RSA Cryptosystem Sensitive messages, when transferred over the internet, need to be encrypted, i.e., changed into a secret code in such a way that only the intended receiver who has the secret key is able to read it. It is common that alphabetical characters are converted to their numerical ASCII equivalents before they are encrypted, hence the coded message will look like integer strings. The RSA algorithm is an encryption-decryption process which is widely employed today. In practice, the encryption key can be made public, and doing so will not risk the security of the system. This feature is a characteristic of the so-called public-key cryptosystem. Ali selects two distinct primes p and q which are very large, over a hundred digits each. He computes n = pq, ϕ = (p − 1)(q − 1), and determines a rather small number e which will serve as the encryption key, making sure that e has no common factor with ϕ. He then chooses another integer d < n satisfying de % ϕ = 1; This d is his decryption key. When all is ready, Ali gives to Beth the pair (n; e) and keeps the rest secret.
    [Show full text]
  • A Clasification of Known Root Prime-Generating
    Special properties of the first absolute Fermat pseudoprime, the number 561 Marius Coman Bucuresti, Romania email: [email protected] Abstract. Though is the first Carmichael number, the number 561 doesn’t have the same fame as the third absolute Fermat pseudoprime, the Hardy-Ramanujan number, 1729. I try here to repair this injustice showing few special properties of the number 561. I will just list (not in the order that I value them, because there is not such an order, I value them all equally as a result of my more or less inspired work, though they may or not “open a path”) the interesting properties that I found regarding the number 561, in relation with other Carmichael numbers, other Fermat pseudoprimes to base 2, with primes or other integers. 1. The number 2*(3 + 1)*(11 + 1)*(17 + 1) + 1, where 3, 11 and 17 are the prime factors of the number 561, is equal to 1729. On the other side, the number 2*lcm((7 + 1),(13 + 1),(19 + 1)) + 1, where 7, 13 and 19 are the prime factors of the number 1729, is equal to 561. We have so a function on the prime factors of 561 from which we obtain 1729 and a function on the prime factors of 1729 from which we obtain 561. Note: The formula N = 2*(d1 + 1)*...*(dn + 1) + 1, where d1, d2, ...,dn are the prime divisors of a Carmichael number, leads to interesting results (see the sequence A216646 in OEIS); the formula M = 2*lcm((d1 + 1),...,(dn + 1)) + 1 also leads to interesting results (see the sequence A216404 in OEIS).
    [Show full text]
  • 1 Abelian Group 266 Absolute Value 307 Addition Mod P 427 Additive
    1 abelian group 266 certificate authority 280 absolute value 307 certificate of primality 405 addition mod P 427 characteristic equation 341, 347 additive identity 293, 497 characteristic of field 313 additive inverse 293 cheating xvi, 279, 280 adjoin root 425, 469 Chebycheff’s inequality 93 Advanced Encryption Standard Chebycheff’s theorem 193 (AES) 100, 106, 159 Chinese Remainder Theorem 214 affine cipher 13 chosen-plaintext attack xviii, 4, 14, algorithm xix, 150 141, 178 anagram 43, 98 cipher xvii Arithmetica key exchange 183 ciphertext xvii, 2 Artin group 185 ciphertext-only attack xviii, 4, 14, 142 ASCII xix classic block interleaver 56 asymmetric cipher xviii, 160 classical cipher xviii asynchronous cipher 99 code xvii Atlantic City algorithm 153 code-book attack 105 attack xviii common divisor 110 authentication 189, 288 common modulus attack 169 common multiple 110 baby-step giant-step 432 common words 32 Bell’s theorem 187 complex analysis 452 bijective 14, 486 complexity 149 binary search 489 composite function 487 binomial coefficient 19, 90, 200 compositeness test 264 birthday paradox 28, 389 composition of permutations 48 bit operation 149 compression permutation 102 block chaining 105 conditional probability 27 block cipher 98, 139 confusion 99, 101 block interleaver 56 congruence 130, 216 Blum integer 164 congruence class 130, 424 Blum–Blum–Shub generator 337 congruential generator 333 braid group 184 conjugacy problem 184 broadcast attack 170 contact method 44 brute force attack 3, 14 convolution product 237 bubble sort 490 coprime
    [Show full text]
  • On Types of Elliptic Pseudoprimes
    journal of Groups, Complexity, Cryptology Volume 13, Issue 1, 2021, pp. 1:1–1:33 Submitted Jan. 07, 2019 https://gcc.episciences.org/ Published Feb. 09, 2021 ON TYPES OF ELLIPTIC PSEUDOPRIMES LILJANA BABINKOSTOVA, A. HERNANDEZ-ESPIET,´ AND H. Y. KIM Boise State University e-mail address: [email protected] Rutgers University e-mail address: [email protected] University of Wisconsin-Madison e-mail address: [email protected] Abstract. We generalize Silverman's [31] notions of elliptic pseudoprimes and elliptic Carmichael numbers to analogues of Euler-Jacobi and strong pseudoprimes. We inspect the relationships among Euler elliptic Carmichael numbers, strong elliptic Carmichael numbers, products of anomalous primes and elliptic Korselt numbers of Type I, the former two of which we introduce and the latter two of which were introduced by Mazur [21] and Silverman [31] respectively. In particular, we expand upon the work of Babinkostova et al. [3] on the density of certain elliptic Korselt numbers of Type I which are products of anomalous primes, proving a conjecture stated in [3]. 1. Introduction The problem of efficiently distinguishing the prime numbers from the composite numbers has been a fundamental problem for a long time. One of the first primality tests in modern number theory came from Fermat Little Theorem: if p is a prime number and a is an integer not divisible by p, then ap−1 ≡ 1 (mod p). The original notion of a pseudoprime (sometimes called a Fermat pseudoprime) involves counterexamples to the converse of this theorem. A pseudoprime to the base a is a composite number N such aN−1 ≡ 1 mod N.
    [Show full text]
  • Fast Tabulation of Challenge Pseudoprimes
    Fast Tabulation of Challenge Pseudoprimes Andrew Shallue Jonathan Webster Illinois Wesleyan University Butler University ANTS-XIII, 2018 1 / 18 Outline Elementary theorems and definitions Challenge pseudoprime Algorithmic theory Sketch of analysis Future work 2 / 18 Definition If n is a composite integer with gcd(b, n) = 1 and bn−1 ≡ 1 (mod n) then we call n a base b Fermat pseudoprime. Fermat’s Little Theorem Theorem If p is prime and gcd(b, p) = 1 then bp−1 ≡ 1 (mod p). 3 / 18 Fermat’s Little Theorem Theorem If p is prime and gcd(b, p) = 1 then bp−1 ≡ 1 (mod p). Definition If n is a composite integer with gcd(b, n) = 1 and bn−1 ≡ 1 (mod n) then we call n a base b Fermat pseudoprime. 3 / 18 Lucas Sequences Definition Let P, Q be integers, and let D = P2 − 4Q (called the discriminant). Let α and β be the two roots of x 2 − Px + Q. Then we have an integer sequence Uk defined by αk − βk U = k α − β called the (P, Q)-Lucas sequence. Definition Equivalently, we may define this as a recurrence relation: U0 = 0, U1 = 1, and Un = PUn−1 − QUn−2. 4 / 18 Definition If n is a composite integer with gcd(n, 2QD) = 1 such that Un−(n) ≡ 0 (mod n) then we call n a (P, Q)-Lucas pseudoprime. An Analogous Theorem Theorem Let the (P, Q)-Lucas sequence be given, and let (n) = (D|n) be the Jacobi symbol. If p is an odd prime and gcd(p, 2QD) = 1, then Up−(p) ≡ 0 (mod p) 5 / 18 An Analogous Theorem Theorem Let the (P, Q)-Lucas sequence be given, and let (n) = (D|n) be the Jacobi symbol.
    [Show full text]
  • The Complexity of Prime Number Tests
    Die approbierte Originalversion dieser Diplom-/ Masterarbeit ist in der Hauptbibliothek der Tech- nischen Universität Wien aufgestellt und zugänglich. http://www.ub.tuwien.ac.at The approved original version of this diploma or master thesis is available at the main library of the Vienna University of Technology. http://www.ub.tuwien.ac.at/eng The Complexity of Prime Number Tests Diplomarbeit Ausgeführt am Institut für Diskrete Mathematik und Geometrie der Technischen Universität Wien unter der Anleitung von Univ.Prof. Dipl.-Ing. Dr.techn. Michael Drmota durch Theres Steiner, BSc Matrikelnummer: 01025110 Ort, Datum Unterschrift (Student) Unterschrift (Betreuer) The problem of distinguishing prime numbers from composite numbers and of re- solving the latter into their prime factors is known to be one of the most important and useful in arithmetic. Carl Friedrich Gauss, Disquisitiones Arithmeticae, 1801 Ron and Hermione have 2 children: Rose and Hugo. Vogon poetry is the 3rd worst in the universe. Acknowledgements First, I would like to thank my parents, Rudolf and Doris Steiner, without them I would not be where I am now. I would also like to thank my professor Michael Drmota for supporting me and helping me with my thesis. Throughout the writing process he was always there for me and his input was always helpful. I would also like to thank my colleagues who made this stage of my life truly amazing. Also, a special thanks to the people that gave me valuable input on my thesis, mathematically or grammatically. 4 5 is the 5th digit in π. Abstract Prime numbers have been a signicant focus of mathematics throughout the years.
    [Show full text]
  • Independence of the Miller-Rabin and Lucas Probable Prime Tests
    Independence of the Miller-Rabin and Lucas Probable Prime Tests Alec Leng Mentor: David Corwin March 30, 2017 1 Abstract In the modern age, public-key cryptography has become a vital component for se- cure online communication. To implement these cryptosystems, rapid primality test- ing is necessary in order to generate keys. In particular, probabilistic tests are used for their speed, despite the potential for pseudoprimes. So, we examine the commonly used Miller-Rabin and Lucas tests, showing that numbers with many nonwitnesses are usually Carmichael or Lucas-Carmichael numbers in a specific form. We then use these categorizations, through a generalization of Korselt’s criterion, to prove that there are no numbers with many nonwitnesses for both tests, affirming the two tests’ relative independence. As Carmichael and Lucas-Carmichael numbers are in general more difficult for the two tests to deal with, we next search for numbers which are both Carmichael and Lucas-Carmichael numbers, experimentally finding none less than 1016. We thus conjecture that there are no such composites and, using multi- variate calculus with symmetric polynomials, begin developing techniques to prove this. 2 1 Introduction In the current information age, cryptographic systems to protect data have become a funda- mental necessity. With the quantity of data distributed over the internet, the importance of encryption for protecting individual privacy has greatly risen. Indeed, according to [EMC16], cryptography is allows for authentication and protection in online commerce, even when working with vital financial information (e.g. in online banking and shopping). Now that more and more transactions are done through the internet, rather than in person, the importance of secure encryption schemes is only growing.
    [Show full text]
  • Fermat Pseudoprimes
    1 TWO HUNDRED CONJECTURES AND ONE HUNDRED AND FIFTY OPEN PROBLEMS ON FERMAT PSEUDOPRIMES (COLLECTED PAPERS) Education Publishing 2013 Copyright 2013 by Marius Coman Education Publishing 1313 Chesapeake Avenue Columbus, Ohio 43212 USA Tel. (614) 485-0721 Peer-Reviewers: Dr. A. A. Salama, Faculty of Science, Port Said University, Egypt. Said Broumi, Univ. of Hassan II Mohammedia, Casablanca, Morocco. Pabitra Kumar Maji, Math Department, K. N. University, WB, India. S. A. Albolwi, King Abdulaziz Univ., Jeddah, Saudi Arabia. Mohamed Eisa, Dept. of Computer Science, Port Said Univ., Egypt. EAN: 9781599732572 ISBN: 978-1-59973-257-2 1 INTRODUCTION Prime numbers have always fascinated mankind. For mathematicians, they are a kind of “black sheep” of the family of integers by their constant refusal to let themselves to be disciplined, ordered and understood. However, we have at hand a powerful tool, insufficiently investigated yet, which can help us in understanding them: Fermat pseudoprimes. It was a night of Easter, many years ago, when I rediscovered Fermat’s "little" theorem. Excited, I found the first few Fermat absolute pseudoprimes (561, 1105, 1729, 2465, 2821, 6601, 8911…) before I found out that these numbers are already known. Since then, the passion for study these numbers constantly accompanied me. Exceptions to the above mentioned theorem, Fermat pseudoprimes seem to be more malleable than prime numbers, more willing to let themselves to be ordered than them, and their depth study will shed light on many properties of the primes, because it seems natural to look for the rule studying it’s exceptions, as a virologist search for a cure for a virus studying the organisms that have immunity to the virus.
    [Show full text]
  • On $ K $-Lehmer Numbers
    ON k-LEHMER NUMBERS JOSE´ MAR´IA GRAU AND ANTONIO M. OLLER-MARCEN´ Abstract. Lehmer’s totient problem consists of determining the set of pos- itive integers n such that ϕ(n)|n − 1 where ϕ is Euler’s totient function. In this paper we introduce the concept of k-Lehmer number. A k-Lehmer num- ber is a composite number such that ϕ(n)|(n − 1)k. The relation between k-Lehmer numbers and Carmichael numbers leads to a new characterization of Carmichael numbers and to some conjectures related to the distribution of Carmichael numbers which are also k-Lehmer numbers. AMS 2000 Mathematics Subject Classification: 11A25,11B99 1. Introduction Lehmer’s totient problem asks about the existence of a composite number such that ϕ(n)|(n − 1), where ϕ is Euler’s totient function. Some authors denote these numbers by Lehmer numbers. In 1932, Lehmer (see [13]) showed that every Lemher numbers n must be odd and square-free, and that the number of distinct prime factors of n, d(n), must satisfy d(n) > 6. This bound was subsequently extended to d(n) > 10. The current best result, due to Cohen and Hagis (see [9]), is that n must have at least 14 prime factors and the biggest lower bound obtained for such numbers is 1030 (see [17]). It is known that there are no Lehmer numbers in certain sets, such as the Fibonacci sequence (see [15]), the sequence of repunits in base g for any g ∈ [2, 1000] (see [8]) or the Cullen numbers (see [11]).
    [Show full text]
  • 1 Fermat Pseudoprimes 2 Carmichael Numbers
    Z∗ Z∗ MATH/CSCI 4116: CRYPTOGRAPHY, FALL 2014 Then G is a subgroup of n, thus |G| 6 | n|. Since n is not a Fermat pseudo- Z∗ Z∗ Handout 3: The Miller-Rabin Primality Test prime, there exists some b ∈ n with b 6∈ G, thus |G| < | n|. It follows that 1 Z∗ n−1 |G| 6 2 | n| 6 2 . Finally, whenever b ∈ {1,...,n − 1} and b 6∈ G, then b Peter Selinger n−1 fails the test; there are at least 2 such elements. Algorithm 1.3 (Fermat pseudoprime test). 1 Fermat Pseudoprimes Input: Integers n > 2 and t > 1. Output: If n is prime, output “yes”. If n is not a Fermat pseudoprime, output “no” A primality test is an algorithm that, given an integer n, decides whether n is prime with probability at least 1 − 1/2t, “yes” with probability at most 1/2t. or not. The most naive algorithm, trial division, is hopelessly inefficient when n is Algorithm: Pick t independent, uniformly distributed random numbers b1,...,bt ∈ very large. Fortunately, there exist much more efficient algorithms for determining −1 . If n mod for all , output “yes”, else output “no”. whether n is prime. The most common such algorithms are probabilistic; they {1,...,n − 1} bi ≡ 1( n) i give the correct answer with very high probability. All efficient primality testing algorithms are based, in one way or another, on Fermat’s Little Theorem. Proof. We prove that the output of the algorithm is as specified. If n is prime, then the algorithm outputs “yes” by Fermat’s Little Theorem.
    [Show full text]
  • Grained Integers and Applications to Cryptography
    poses. These works may not bemission posted of elsewhere the without copyright the holder. explicit (Last written update per- 2017/11/29-18 :20.) . Grained integers and applications to cryptography Rheinischen Friedrich-Willhelms-Universität Bonn Mathematisch-Naturwissenschaftlichen Fakultät ing any of theseeach documents will copyright adhere holder, to and the in terms particular and use constraints them invoked only by for noncommercial pur- Erlangung des Doktorgrades (Dr. rer. nat.) . Dissertation, Mathematisch-Naturwissenschaftliche Fakultät der Rheinischen Daniel Loebenberger Bonn, Januar 2012 Dissertation vorgelegt von Nürnberg aus der der zur are maintained by the authors orthese by works other are copyright posted holders, here notwithstanding electronically. that It is understood that all persons copy- http://hss.ulb.uni-bonn.de/2012/2848/2848.htm Grained integers and applications to cryptography (2012). OEBENBERGER L ANIEL D Friedrich-Wilhelms-Universität Bonn. URL This document is provided as aand means to technical ensure work timely dissemination on of a scholarly non-commercial basis. Copyright and all rights therein Angefertigt mit Genehmigung der Mathematisch-Naturwissenschaftlichen Fakultät der Rheinischen Friedrich-Wilhelms-Universität Bonn 1. Gutachter: Prof. Dr. Joachim von zur Gathen 2. Gutachter: Prof. Dr. Andreas Stein Tag der Promotion: 16.05.2012 Erscheinungsjahr: 2012 iii Οἱ πρῶτοι ἀριθμοὶ πλείους εἰσὶ παντὸς τοῦ προτένθος πλήθους πρώτων ἀριθμῶν.1 (Euclid) Problema, numeros primos a compositis dignoscendi, hosque in factores suos primos resolvendi, ad gravissima ac ultissima totius arithmeticae pertinere [...] tam notum est, ut de hac re copiose loqui superfluum foret. [...] Praetereaque scientiae dignitas requirere videtur, ut omnia subsidia ad solutionem problematis tam elegantis ac celibris sedulo excolantur.2 (C.
    [Show full text]