The Lenstra elliptic-curve factorization or the elliptic-curve factorization method (ECM) 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.[1] 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.
The Lenstra elliptic-curve factorization method to find a factor of a given natural number
n
Z/nZ
n
y2=x3+ax+b\pmodn
P(x0,y0)
This can be done by first picking random
x0,y0,a\inZ/nZ
b=
2 | |
y | |
0 |
-
3 | |
x | |
0 |
-ax0\pmodn
We can form repeated multiples of a point
P
[k]P=P+\ldots+P(ktimes)
P
Q
n
v\bmodn
\gcd(v,n)
Assuming we calculate a slope of the form
u/v
\gcd(u,v)=1
v=0\bmodn
infty
P(x,y),P'(x,-y)
\gcd(v,n) ≠ 1,n
\gcd(v,n)
n
[k]P
\bmodn
k
B!
B
[B!]P
[2]P
[3]([2]P)
[4]([3!]P)
B
B
\bmodn
\gcd(v,n) ≠ 1,n
n
The time complexity depends on the size of the number's smallest prime factor and can be represented by, where p is the smallest factor of n, or
L | ||||
|
,\sqrt{2}\right]
If p and q are two prime divisors of n, then implies the same equation also and These two smaller elliptic curves with the
\boxplus
kP=infty
NpP=infty
ECM 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 (quite randomly) 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.
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=(x, y) is . Using s we can compute 2A. If the value of s is of the form a/b where b > 1 and gcd(a,b) = 1, we have to find the modular inverse of b. If it does not exist, gcd(n,b) 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(2P). We have Using the Euclidean algorithm: then then then then then Hence and working backwards (a version of the extended Euclidean algorithm): Hence and Given this s, we can compute the coordinates of 2(2P), just as we did above: Just to check that this is indeed a point on the curve: After this, we can compute
3(2P)=4P\boxplus2P
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.
Before considering the projective plane over
(\Z/n\Z)/\sim,
R
(x,y,z)
(x,y,z)\sim(x',y',z')
P2
(x:y:z)
(0:0:0)
In the algorithm, only the group structure of an elliptic curve over the field
R
R
(\Z/n\Z)/\sim
We now state the algorithm in projective coordinates. The neutral element is then given by the point at infinity
(0:1:0)
E(\Z/n\Z)=\{(x:y:z)\inP2 | y2z=x3+axz2+bz3\}
xP,yP,a\in\Z/n\Z
b=
2 | |
y | |
P |
-
3 | |
x | |
P |
-axP
y2=x3+ax+b
ZY2=X3+aZ2X+bZ3
P=(xP:yP:1)
B\in\Z
\Z/p\Z
\#E(\Z/p\Z)
\#E(\Z/p\Z)
k={\rmlcm}(1,...,B)
kP:=P+P+ … +P
E(\Z/n\Z)
\#E(\Z/n\Z)
\Z/n\Z
kP=(0:1:0)
\#E(\Z/p\Z)
kP.
In point 5 it is said that under the right circumstances a non-trivial divisor can be found. As pointed out in Lenstra's article (Factoring Integers with Elliptic Curves) the addition needs the assumption
\gcd(x1-x2,n)=1
P,Q
(0:1:0)
R=P+Q;
P=(x1:y1:1),Q=(x2:y2:1)
λ=(y1-y2)(x1-x
-1 | |
2) |
x3=λ2-x1-x2
y3=λ(x1-x3)-y1
R=P+Q=(x3:y3:1)
If addition fails, this will be due to a failure calculating
λ.
(x1-x
-1 | |
2) |
\Z/n\Z
\Z/n\Z
λ'=y1-y2
x3'={λ'}2-x1(x1-x
2 | |
2) |
-x2(x1-x
2 | |
2) |
y3'=λ'(x1(x1-x
2-x | |
3') |
-y1(x1-x
3 | |
2) |
R=P+Q=(x3'(x1-x2):y3':(x1-x
3) | |
2) |
This calculation is always legal and if the gcd of the -coordinate with ≠ (1 or), so when simplifying fails, a non-trivial divisor of is found.
See main article: Twisted Edwards curve. The use of Edwards curves needs fewer modular multiplications and less time than the use of Montgomery curves or Weierstrass curves (other used methods). Using Edwards curves you can also find more primes.
Definition. Let
k
2 ≠ 0
a,d\ink\setminus\{0\}
a ≠ d
EE,a,d
ax2+y2=1+dx2y2.
a=1
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:
\{(x,y)\inA2:ax2+y2=1+dx2y2\}
The addition law is given by
(e,f),(g,h)\mapsto\left(
eh+fg | , | |
1+degfh |
fh-aeg | |
1-degfh |
\right).
The point (0,1) is its neutral element and the inverse of
(e,f)
(-e,f)
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
\Q
\Z/4\Z,\Z/8\Z,\Z/12\Z,\Z/2\Z x \Z/4\Z
\Z/2\Z x \Z/8\Z
The most interesting cases for ECM are
\Z/12\Z
\Z/2\Z x \Z/8\Z
\Z/12\Z
x2+y2=1+dx2y2
(a,b)
b\notin\{-2,-1/2,0,\pm1\},a2=-(b2+2b)
d=-(2b+1)/(a2b2)
x2+y2=1+dx2y2
(a,b)
a= | u2-1 |
u2+1 |
,b=-
(u-1)2 | |
u2+1 |
d= | (u2+1)3(u2-4u+1) |
(u-1)6(u+1)2 |
,u\notin\{0,\pm1\}.
Every Edwards curve with a point of order 3 can be written in the ways shown above. Curves with torsion group isomorphic to
\Z/2\Z x \Z/8\Z
\Z/2\Z x \Z/4\Z
The above text is about the first stage of elliptic curve factorisation. There one hopes to find a prime divisor such that
sP
E(Z/pZ)
sP
E(Z/qZ)
We hope the order to be between
B1
B2
B1
B2
sP
(ls)P
The use of Twisted Edwards elliptic curves, as well as other techniques were used by Bernstein et al to provide an optimized implementation of ECM. Its only drawback is that it works on smaller composite numbers than the more general purpose implementation, GMP-ECM of Zimmerman.
There are recent developments in using hyperelliptic curves to factor integers. Cosset shows in his article (of 2010) that one can build a hyperelliptic curve with genus two (so a curve
y2=f(x)
Bernstein, Heninger, Lou, and Valenta suggest GEECM, a quantum version of ECM with Edwards curves.[3] It uses Grover's algorithm to roughly double the length of the primes found compared to standard EECM, assuming a quantum computer with sufficiently many qubits and of comparable speed to the classical computer running EECM.