Improved Arithmetic in the Ideal Class Group of Imaginary Quadratic Number Fields with an Application to Integer Factoring
Total Page:16
File Type:pdf, Size:1020Kb
University of Calgary PRISM: University of Calgary's Digital Repository Graduate Studies The Vault: Electronic Theses and Dissertations 2013-06-14 Improved Arithmetic in the Ideal Class Group of Imaginary Quadratic Number Fields with an Application to Integer Factoring Sayles, Maxwell Sayles, M. (2013). Improved Arithmetic in the Ideal Class Group of Imaginary Quadratic Number Fields with an Application to Integer Factoring (Unpublished master's thesis). University of Calgary, Calgary, AB. doi:10.11575/PRISM/26473 http://hdl.handle.net/11023/752 master thesis University of Calgary graduate students retain copyright ownership and moral rights for their thesis. You may use this material in any way that is permitted by the Copyright Act or through licensing that has been assigned to the document. For uses that are not allowable under copyright legislation or licensing, you are required to seek permission. Downloaded from PRISM: https://prism.ucalgary.ca UNIVERSITY OF CALGARY Improved Arithmetic in the Ideal Class Group of Imaginary Quadratic Number Fields With an Application to Integer Factoring by Maxwell Sayles A THESIS SUBMITTED TO THE FACULTY OF GRADUATE STUDIES IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE DEPARTMENT OF COMPUTER SCIENCE CALGARY, ALBERTA May, 2013 c Maxwell Sayles 2013 Abstract This thesis proposes practical improvements to arithmetic and exponentiation in the ideal class group of imaginary quadratic number fields for the Intel x64 architecture. This is useful in tabulating the class number and class group structure, but also as an application to a novel integer factoring algorithm called \SuperSPAR". SuperSPAR builds upon SPAR using an idea from Sutherland, namely a bounded primorial steps search, as well as by using optimized double-based representations of exponents, and general improvements to arithmetic in the ideal class group. Since the target architecture has 64 bit machine words, we specialize two implementations of ideal class arithmetic: one using 64 bit arithmetic, and the other using 128 bit arithmetic. In each case, our results show an improvement in the average performance of ideal class arithmetic over reference implementations. Since much of the effort of ideal class arithmetic is in computing the extended greatest common divisor, this thesis studies the average perfor- mance of several implementations of this and shows an improvement for some over reference implementations. Dimitrov and Cooklev propose the double base number system, and Im- bert, Jacobson, and Schmidt propose a method of ideal class cubing. Using these ideas, we explore several techniques for exponentiation using 2,3 number systems and demonstrate an improvement in the average performance of exponentiation in the ideal class group over that of binary exponentiation. Lastly, each of these improvements are applied to our implemen- tation of the SuperSPAR factoring algorithm, and our results show an improvement in the average time to factor integers 49 bits to 62 bits in size. i Acknowledgements I would like to thank my supervisor, Dr. Michael J. Jacobson, Jr., for all of his great advice. I am certain that without his patience I would not have finished. I would also like to thank Dr. Andrew Sutherland for his reference implementation of SuperSPAR, and his polite willingness to answer all my questions. I would like to thank Dr. Arthur Schmidt for the idea of exploring a left-to-right binary extended GCD { this may be one of the most critical sub-algorithms in our implementation of SuperSPAR. Furthermore, I would like to thank Dr. Laurent Imbert for pointing out the variety of techniques to compute 2,3 representations, and for reviewing my reading list. In addition, I would like to thank my examining committee, Dr. Renate Scheidler and Dr. Kristine E. Bauer, for taking the time to read this thesis and for their valuable comments. Finally, I would like to thank my wife, Faye, for being by my side, and for her kind understanding, especially during \crunch time". Thank you all. ii Table of Contents Abstract ........................................ i Acknowledgements .................................. ii Table of Contents . iii List of Tables . vi List of Figures . vii 1 Motivation . 1 1.1 Organization and Contributions of this Thesis . 3 2 Ideal Arithmetic . 6 2.1 Quadratic Number Fields . 6 2.2 Ideals and the Class Group . 8 2.3 Ideal Arithmetic . 12 2.3.1 Reduced Representatives . 13 2.3.2 Ideal Class Multiplication . 14 2.3.3 Fast Ideal Multiplication (NUCOMP) . 17 2.3.4 Fast Ideal Squaring (NUDUPL) . 20 2.3.5 Fast Ideal Cubing (NUCUBE) . 21 3 Exponentiation . 24 3.1 Binary Exponentiation . 25 3.2 Non-Adjacent Form Exponentiation . 25 3.3 Double-Base Number Systems . 28 3.3.1 Chained 2,3 Representations . 29 3.3.2 Unchained 2,3 Representations . 30 3.4 Methods for Computing 2,3 Chains/Representations . 34 3.4.1 Right-to-Left Chains (from low-order to high-order) . 34 3.4.2 Left-to-Right Representations (from high-order to low-order) . 36 3.4.3 Pruned Tree of ±1 Nodes . 38 3.4.4 Shortest Additive 2,3 Chains . 39 3.5 Summary . 40 4 SuperSPAR . 42 4.1 SPAR . 42 4.1.1 Ambiguous Classes and the Factorization of the Discriminant . 43 4.1.2 SPAR Algorithm . 44 4.1.3 SPAR Complexity . 45 4.2 SuperSPAR . 46 4.2.1 Bounded Primorial Steps . 47 4.2.2 Primorial Steps for a Set . 49 4.2.3 SuperSPAR Algorithm . 50 4.3 Summary . 53 5 Extended Greatest Common Divisor Experiments . 54 5.1 The Euclidean Algorithm . 55 5.2 Right-to-Left Binary Extended GCD . 56 5.2.1 Windowed Right-to-Left Binary Extended GCD . 59 iii 5.3 Left-to-Right Binary Extended GCD . 61 5.4 Lehmer's Extended GCD . 63 5.5 Partial Extended GCD . 65 5.6 Specialized Implementations of the Extended GCD . 68 5.7 Experimental Results . 71 5.7.1 32-bit Extended GCDs . 73 5.7.2 64-bit Extended GCDs . 81 5.7.3 128-bit Extended GCDs . 88 5.8 Summary . 91 6 Ideal Arithmetic Experiments . 93 6.1 Specialized Implementations of Ideal Arithmetic . 95 6.2 Average Time for Operations . 100 6.3 Summary . 110 7 Exponentiation Experiments . 111 7.1 Binary and Non-Adjacent Form . 113 7.2 Right-to-Left 2,3 Chains . 113 7.3 Windowed Right-to-Left Chains . 115 7.4 Left-to-Right 2,3 Representations . 116 7.5 Pruned Trees . 118 7.6 Left-to-Right Best Approximations . 121 7.7 Additive 2,3 Chains . 123 7.8 Incremental Searching . 125 7.9 Big Exponents from Small Exponents . 126 7.10 Experimental Results . 127 7.11 Summary . 139 8 SuperSPAR Experiments . 140 8.1 Coprime Finding . 145 8.1.1 Coprime Sieve . 146 8.1.2 Coprime Wheel . 146 8.1.3 Comparison . 148 8.2 Lookup Tables . 149 8.2.1 Chaining with List Heads . 152 8.2.2 Open Addressing . 153 8.2.3 Chaining vs. Open Addressing . 153 8.3 Factorization of the Order of Ideal Classes . 153 8.3.1 Prime Power Bound . 155 8.3.2 Difference between the Order of Two Ideal Classes . 157 8.3.3 Best Multipliers . 159 8.3.4 Expected Number of Ideal Classes . 160 8.4 SuperSPAR Algorithm in Practice . 162 8.5 Search Bounds . 168 8.6 Empirical Search for Exponent and Step Count . 174 8.6.1 Two-Dimensional Ternary Search of a Noisy Surface . 179 8.7 Reference Implementation of SPAR . 184 8.8 Comparison to Other Factoring Implementations . 190 iv 9 Conclusions and Future Work . 196 9.1 Ideal Arithmetic . 197 9.2 Exponentiation . 198 9.3 Super2SPAR . 200 Bibliography . 202 v List of Tables 6.1 Relative Average Cost of Ideal Arithmetic. 103 7.1 Best 16 bit exponentiation techniques. 128 7.2 Average time (microseconds) to exponentiate 16 bit exponents. 129 8.1 The first 12 primorials. 149 e pi i 8.2 The probability.