Lenstra elliptic-curve factorization
The Lenstra elliptic-curve factorization or the elliptic-curve factorization method is a fast, sub-exponential running time, algorithm for integer factorization, which employs elliptic curves. For general-purpose factoring, ECM is the third-fastest known factoring method. The second-fastest is the multiple polynomial quadratic sieve, and the fastest is the general number field sieve. The Lenstra elliptic-curve factorization is named after Hendrik Lenstra.
Practically speaking, ECM is considered a special-purpose factoring algorithm, as it is most suitable for finding small factors., it is still the best algorithm for divisors not exceeding 50 to 60 digits, as its running time is dominated by the size of the smallest factor p rather than by the size of the number n to be factored. Frequently, ECM is used to remove small factors from a very large integer with many factors; if the remaining integer is still composite, then it has only large factors and is factored using general-purpose techniques. The largest factor found using ECM so far has 83 decimal digits and was discovered on 7 September 2013 by R. Propper. Increasing the number of curves tested improves the chances of finding a factor, but they are not linear with the increase in the number of digits.
Algorithm
The Lenstra elliptic-curve factorization method to find a factor of a given natural number works as follows:- Pick a random elliptic curve over, with equation of the form together with a non-trivial point on it.
- :This can be done by first picking random, and then setting to assure the point is on the curve.
- One can define Addition of two points on the curve, to define a Group. The addition laws are given in the article on elliptic curves.
- :We can form repeated multiples of a point :. The addition formulae involve taking the modular slope of a chord joining and, and thus division between residue classes modulo, performed using the extended Euclidean algorithm. In particular, division by some includes calculation of the.
- : Assuming we calculate a slope of the form with, then if, the result of the point addition will be, the point "at infinity" corresponding to the intersection of the "vertical" line joining and the curve. However, if, then the point addition will not produce a meaningful point on the curve; but, more importantly, is a non-trivial factor of.
- Compute on the elliptic curve, where is a product of many small numbers: say, a product of small primes raised to small powers, as in the p-1 algorithm, or the factorial for some not too large. This can be done efficiently, one small factor at a time. Say, to get, first compute, then, then, and so on. is picked to be small enough so that -wise point addition can be performed in reasonable time.
- *If we finish all the calculations above without encountering non-invertible elements, it means that the elliptic curves' order is not smooth enough, so we need to try again with a different curve and starting point.
- *If we encounter a we are done: it is a non-trivial factor of.
Why does the algorithm work?
If p and q are two prime divisors of n, then implies the same equation also and These two smaller elliptic curves with the -addition are now genuine groups. If these groups have Np and Nq elements, respectively, then for any point P on the original curve, by Lagrange's theorem, is minimal such that on the curve modulo p implies that k divides Np; moreover,. The analogous statement holds for the curve modulo q. When the elliptic curve is chosen randomly, then Np and Nq are random numbers close to and respectively. Hence it is unlikely that most of the prime factors of Np and Nq are the same, and it is quite likely that while computing eP, we will encounter some kP that is ∞ but not or vice versa. When this is the case, kP does not exist on the original curve, and in the computations we found some v with either or but not both. That is, gave a non-trivial factorECM is at its core an improvement of the older algorithm. The algorithm finds prime factors p such that is b-powersmooth for small values of b. For any e, a multiple of and any a relatively prime to p, by Fermat's little theorem we have. Then is likely to produce a factor of n. However, the algorithm fails when has large prime factors, as is the case for numbers containing strong primes, for example.
ECM gets around this obstacle by considering the group of a random elliptic curve over the finite field Zp, rather than considering the multiplicative group of Zp which always has order
The order of the group of an elliptic curve over Zp varies between and by Hasse's theorem, and is likely to be smooth for some elliptic curves. Although there is no proof that a smooth group order will be found in the Hasse-interval, by using heuristic probabilistic methods, the Canfield–Erdős–Pomerance theorem with suitably optimized parameter choices, and the L-notation, we can expect to try curves before getting a smooth group order. This heuristic estimate is very reliable in practice.
An example
The following example is from, with some details added.We want to factor Let's choose the elliptic curve with the point on it, and let's try to compute
The slope of the tangent line at some point A= is. Using s we can compute 2A. If the value of s is of the form a/b where b > 1 and gcd = 1, we have to find the modular inverse of b. If it does not exist, gcd is a non-trivial factor of n.
First we compute 2P. We have so the coordinates of are and all numbers understood Just to check that this 2P is indeed on the curve:
Then we compute 3. We have Using the Euclidean algorithm: then then then then then Hence and working backwards : Hence and Given this s, we can compute the coordinates of 2, just as we did above: Just to check that this is indeed a point on the curve: After this, we can compute.
We can similarly compute 4!P, and so on, but 8!P requires inverting The Euclidean algorithm gives that 455839 is divisible by 599, and we have found a
The reason that this worked is that the curve has points, while it has points. Moreover, 640 and 777 are the smallest positive integers k such that on the curve and respectively. Since is a multiple of 640 but not a multiple of 777, we have on the curve but not on the curve hence the repeated addition broke down here, yielding the factorization.
The algorithm with projective coordinates
Before considering the projective plane over first consider a 'normal' projective space over ℝ: Instead of points, lines through the origin are studied. A line may be represented as a non-zero point, under an equivalence relation ~ given by: ⇔ ∃ c ≠ 0 such that x' = cx, y' = cy and z' = cz. Under this equivalence relation, the space is called the projective plane ; points, denoted by, correspond to lines in a three-dimensional space that pass through the origin. Note that the point does not exist in this space since to draw a line in any possible direction requires at least one of x',y' or z' ≠ 0. Now observe that almost all lines go through any given reference plane - such as the -plane, whilst the lines precisely parallel to this plane, having coordinates, specify directions uniquely, as 'points at infinity' that are used in the affine -plane it lies above.In the algorithm, only the group structure of an elliptic curve over the field ℝ is used. Since we do not necessarily need the field ℝ, a finite field will also provide a group structure on an elliptic curve. However, considering the same curve and operation over with not a prime does not give a group. The Elliptic Curve Method makes use of the failure cases of the addition law.
We now state the algorithm in projective coordinates. The neutral element is then given by the point at infinity. Let be a integer and consider the elliptic curve .
- Pick with ≠ 0.
- Calculate. The elliptic curve is then in Weierstrass form given by and by using projective coordinates the elliptic curve is given by the homogeneous equation. It has the point.
- Choose an upperbound for this elliptic curve. Remark: You will only find factors if the group order of the elliptic curve over is B-smooth, which means that all prime factors of have to be less or equal to.
- Calculate.
- Calculate in the ring. Note that if is -smooth and is prime that. However, if only is B-smooth for some divisor of, the product might not be because addition and multiplication are not well-defined if is not prime. In this case, a non-trivial divisor can be found.
- If not, then go back to step 2. If this does occur, then you will notice this when simplifying the product
- To calculate: ,
- ,
- ,
- ,
- .
- ,
- ,
- ,
- , and simplify if possible.
Twisted Edwards curves
The use of Edwards curves needs fewer modular multiplications and less time than the use of Montgomery curves or Weierstrass curves. Using Edwards curves you can also find more primes.Definition. Let be a field in which, and let with. Then the twisted Edwards curve is given by An Edwards curve is a twisted Edwards curve in which.
There are five known ways to build a set of points on an Edwards curve: the set of affine points, the set of projective points, the set of inverted points, the set of extended points and the set of completed points.
The set of affine points is given by:
The addition law is given by
The point is its neutral element and the inverse of is.
The other representations are defined similar to how the projective Weierstrass curve follows from the affine.
Any elliptic curve in Edwards form has a point of order 4. So the torsion group of an Edwards curve over is isomorphic to either or.
The most interesting cases for ECM are and, since they force the group orders of the curve modulo primes to be divisible by 12 and 16 respectively. The following curves have a torsion group isomorphic to :
- with point where and
- with point where and
Stage 2
The above text is about the first stage of elliptic curve factorisation. There one hopes to find a prime divisor such that is the neutral element of.In the second stage one hopes to have found a prime divisor such that has small prime order in.
We hope the order to be between and, where is determined in stage 1 and is new stage 2 parameter.
Checking for a small order of, can be done by computing modulo for each prime.