The Quadratic Sieve Factoring Algorithm
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
The Quadratic Sieve Factoring Algorithm
Eric Landquist
MATH488:Cryptographic Algorithms
December14,2001
1Introduction
Mathematicians have been attempting tofind better and faster ways to fac-
tor composite numbers since the beginning of time.Initially this involved
dividing a number by larger and larger primes until you had the factoriza-
tion.This trial division was not improved upon until Fermat applied the
factorization of the difference of two squares:a2−b2=(a−b)(a+b).In his method,we begin with the number to be factored:n.Wefind the smallest
square larger than n,and test to see if the difference is square.If so,then
we can apply the trick of factoring the difference of two squares tofind the
factors of n.If the difference is not a perfect square,then wefind the next
largest square,and repeat the process.
While Fermat’s method is much faster than trial division,when it comes
to the real world of factoring,for example factoring an RSA modulus several
hundred digits long,the purely iterative method of Fermat is too slow.Sev-
eral other methods have been presented,such as the Elliptic Curve Method
discovered by H.Lenstra in1987and a pair of probabilistic methods by
Pollard in the mid70’s,the p−1method and theρmethod.The fastest
algorithms,however,utilize the same trick as Fermat,examples of which are
the Continued Fraction Method,the Quadratic Sieve(and it variants),and
the Number Field Sieve(and its variants).The exception to this is the El-
liptic Curve Method,which runs almost as fast as the Quadratic Sieve.The
remainder of this paper focuses on the Quadratic Sieve Method.
2The Quadratic Sieve
The Quadratic Sieve,hereafter simply called the QS,was invented by Carl
Pomerance in1981,extending earlier ideas of Kraitchik and Dixon.The QS
was the fastest known factoring algorithm until the Number Field Sieve was
discovered in1993.Still the QS is faster than the Number Field Sieve for
numbers up to110digits long.
1
3How it Works
If n is the number to be factored,the QS attemps to find two numbers x and y such that x ≡±y (mod n )and x 2≡y 2(mod n ).This would imply that (x −y )(x +y )≡0(mod n ),and we simply compute (x −y,n )using the Euclidean Algorithm to see if this is a nontrivial divisor.There is at least a 1chance that the factor will be nontrivial.Our first step in doing so is to define Q (x )=(x + √n )2−n =˜x 2−n,
and compute Q (x 1),Q (x 2),...,Q (x k ).Determining the x i will be explained below.From the evaluations of Q (x ),we want to pick a subset such that Q (x i 1)Q (x i 2)...Q (x i r )is a square,y 2.Then note that for all x ,Q (x )≡˜x 2
(mod n ).So what we have then is that
Q (x i 1)Q (x i 2)...Q (x i r )≡(x i 1x i 2...x i r )2(mod n ).
And if the conditions above hold,then we have factors of n .
3.1Setting up a Factor Base and a Sieving Interval With the basic outline of the QS in place,we need an efficient way to de-termine our x i ,and to get a product of the Q (x i )to be a square.Now to check to see if the product is a square,the exponents of the prime factors of the product need to all be even.So we will need to factor each of the Q (x i ).Therefore,we want them to be small and to factor over a fixed set of small prime numbers (including -1),which we call our factor base.To make Q (x )small,we need to select x close to 0,so we set a bound M and only consider values of x over the sieving interval [−M,M ].(Alternatively,we could have defined Q (x )=x 2−n and let the sieving interval be [ √n −M, √n +M ].)Now if x is in this sieving interval,and if some prime p divides Q (x ),then
(x − √n )2≡n (mod p ),
so n is a quadratic residue (mod p ).So the primes in our factor base must be primes such that the Legendre symbol
n
p =1.
2