Eindhoven University of Technology MASTER a Study of the General
Total Page:16
File Type:pdf, Size:1020Kb
Eindhoven University of Technology MASTER A study of the general number field sieve and a development of a CT2 plug-in using YAFU Querejeta Azurmendi, I. Award date: 2016 Link to publication Disclaimer This document contains a student thesis (bachelor's or master's), as authored by a student at Eindhoven University of Technology. Student theses are made available in the TU/e repository upon obtaining the required degree. The grade received is not published on the document as presented in the repository. The required complexity or quality of research of student theses may vary by program, and the required minimum study period may vary in duration. General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain A study of the General Number Field Sieve and a development of a CT2 plug-in using YAFU A thesis submitted for the degree of Master of Science. Technical University of Eindhoven Department of Mathematics and Computer Science Supervisors: Prof. Dr. Tanja Lange Author: Henry de Valence I~nigoQuerejeta Azurmendi Advisors: 0870120 Cristina Balasoiu Prof. Bernhard Esslinger Armin Krauss July 28, 2016 ii Abstract The Number Field Sieve (NFS) is the fastest known algorithm for factoring general numbers having more than 100 decimal digits. This thesis will cover the theory behind the algorithm, going through different fields of math- ematics, such as complex analysis, algebraic number theory, or theory of ideals. We present a plug-in developed for the CrypTool 2 (CT2) applica- tion. Our plug-in makes use of an already existing implementation (YAFU) of the number field sieve and finally we present some comparisons with the previously existing factoring plug-ins. iii Acknowledgements I would like to express my greatest appreciation to the people who have helped and supported me throughout my master project. To my supervisor Prof. Dr. Tanja Lange for introducing me to CrypTool 2 and making possible an Internship abroad. Many thanks as well for the guidance during my project and the last comments in the proofreading task. To Prof. Bernhard Esslinger. First of all for accepting me as part of this project. It is now with great pleasure that I have taken part in the CrypTool 2 group. Secondly, the critical questions and guidance throughout the thesis have been of great help as well as the time spent for feedback. To Armin Krauss for your constant support in the development of the plug-in. Without your participation and input, the plug-in could not have been successfully implemented in that quality. To Henry de Valence for your patience and time spent in task of proofreading. Last, but not least, I would like to thank my family and friends for giving me unconditional support, and for having made this experience of the master as fulfilling as it has been. I~nigoQuerejeta Eindhoven July, 2016 iv Contents Abstract ii Acknowledgements iii List of Figures vii List of Variables viii 1 Introduction 1 2 Factorizing Algorithms Using the Difference of Squares 3 2.1 Fermat's Factorizing Algorithm . 3 2.2 Dixon's Method and the Quadratic Sieve . 5 3 Interlude 11 3.1 Introduction . 11 3.2 Algebraic Number Theory . 12 3.3 Theory of Ideals . 13 4 The General Number Field Sieve 19 4.1 Creating a Difference of Squares . 19 4.2 Smoothness and the Algebraic Factor Base . 23 4.3 Creating Squares in Oα ..................... 31 5 Details of the General Number Field Sieve 35 5.1 The Polynomial Selection Problem . 36 5.2 The Sieving Step . 39 5.2.1 The Rational Sieve . 40 5.2.2 The Algebraic Sieve . 42 5.2.3 Lattice Sieving . 43 5.3 The Linear Algebra Step (Matrix Reduction) . 44 5.3.1 Gaussian Elimination . 44 5.3.2 Standard Lanczos Algorithm . 46 5.3.3 Lanczos in GF(2) . 51 v vi CONTENTS 5.4 Computing the Square Root . 52 6 The GNFS Algorithm and the Security of Cryptographic Keys 53 6.1 State of the Art of the GNFS . 53 6.2 LogJam and FREAK Attack . 56 6.2.1 LogJam attack . 57 6.3 TeslaCrypt Malware . 59 6.4 Conclusion . 61 7 CrypTool 2 Plug-in 65 7.1 Introduction to CrypTool 2 . 65 7.2 Factoring Algorithms besides GNFS, QS, or Fermat's Made Newly Available in CT2 . 66 7.9 The New GeneralFactorizer . 74 7.9.1 YAFU (Yet Another Factorization Utility) . 74 7.9.2 The Plug-in . 75 7.10 Results and Further Work . 77 7.10.1 Performance of the Plug-in . 77 7.10.2 Further Work for the GeneralFactorizer . 84 Appendices 87 A Numbers used for performance tests 89 List of Figures 6.1 Advances in factorization through time, with the size of keys in bits (y-axis) for RSA numbers. Data taken from [9] . 55 6.2 MITM attack overview . 57 6.3 Top 512-bit DH primes for TLS. 8.4% of Alexa Top 1M HTTPS domains allow DHE EXPORT, of which 92.3% use one of the two most popular primes, shown here. Taken from [12] . 58 6.4 An overview of the session key generation . 60 6.5 Number of YAFU downloads in the last year. The method to decrypt infected files was given in December 2015 . 61 6.6 Security strength through different time frames . 62 7.1 GUI of the plug-in . 76 7.2 Drop down box of available choices . 78 7.3 Drop down box for determining search of ECM . 79 7.4 Performance of the GeneralFactorizer for a 300-bit number, lasting slightly above 8 minutes . 80 7.5 Performance of the old Quadratic Sieve plug-in for a 300-bit number, lasting slightly below 12 minutes . 80 7.6 Comparison of performance with time in logarithmic scale. Numbers can be found in Table A.1 . 81 7.7 Performance of the GeneralFactorizer with number 1 from Table A.2 . 82 7.8 Comparison of performance with time in logarithmic scale. Numbers can be found in Table A.2 . 83 vii viii LIST OF FIGURES List of Variables n = p q Number to be factored. × e RSA public key. Chapter 2 on- wards, exponents of factorization. d RSA private key. Chapter 2 on- wards, degree of a polynomial. φ Eulers phi function. Chapter 2 on- wards natural homomorphism φ : Z[α] Z=nZ. ! x; y Difference of squares x2 y2 ≡ (mod n). = p1; : : : ; pS Factor base of small primes. F f g S = Size of the factor base. jFj B Factor base bound, pS B. ≤ U Set of relations. U Size of set U. j j ei Exponents of primes in factoriza- tion. vi Binary vector related to factoriza- tion. L Number of relations found. Q Subfield consisting of algebraic numbers. O Set of all algebraic integers. Oα Set of algebraic integers in Q(α). D Dedekind domain. m Root of polynomial f modulo n. (a; b) Relations, such that (a + bα) and a + bm are smooth. f(t) Z[t] Monic irreducible polynomial. 2 f 0(t) Derivative of f. α Root of minimal polynomial. αi Different roots of f(t). σi Embeddings such that σi(α) = αi. N(a; b) Norm of (a + bα). F (X; Y ) Homogenized polynomial of f. (r; p) Pair representing degree one prime ideals. lp;r(a + bα) Power of prime ideal (r; p) such that a + br 0 (mod p). ≡ χq Quadratic characters. Sieving region. A [ u; u] Region from which we choose the − values of (a; b). Chapter 1 Introduction For centuries two problems in number theory have kept many mathe- maticians busy: determining if a given integer is prime and expressing a given whole number as a product of primes. Now, the first problem is considered to be solved using probabilistic algorithms [8], mainly because of their computational speed compared to the available deterministic algorithms (despite the fact that it is in P ). Even if the second one might seem a straightforward problem for reasonably small numbers, it becomes complicated when we consider huge numbers. In fact, the difficulty of this problem is what gave rise to the well known RSA (Rivest-Shamir-Adleman) cryptosystem [53], the first public-key cryptosystem, consisting of two keys for every user, one private and one public, and offering a secure communication over an insecure channel, such as the Internet. Still today, RSA is one of the standards of secure electronic communication and is also used for digital signatures, so the interest to factorization remains one of the main topics of discrete mathematics. When we talk about RSA, we must specify that the security comes with the usage of at least 1024-bit composite numbers of the form n = p q where p and q are primes of × roughly the same size. This means that we are talking about numbers with 310 decimal digits. This number, whose factorization is unknown, ≈ together with a number e Z=nZ is what forms the public key. The private 2 key, d Z=nZ, is then generated by calculating the inverse of e mod (φ(n)) 2 where φ is Euler's phi function, calculated by φ(n) = (p 1)(q 1). − − Therefore, if we manage to factor number n we can calculate the private key and the cryptosystem is broken.