HOME

TheInfoList



OR:

The Lenstra elliptic-curve factorization or the elliptic-curve factorization method (ECM) is a fast, sub-
exponential running time In computational complexity theory, the complexity class EXPTIME (sometimes called EXP or DEXPTIME) is the set of all decision problems that are solvable by a deterministic Turing machine in exponential time, i.e., in O(2''p''(''n'')) time, whe ...
, algorithm for
integer factorization In number theory, integer factorization is the decomposition of a composite number into a product of smaller integers. If these factors are further restricted to prime numbers, the process is called prime factorization. When the numbers are suf ...
, which employs
elliptic curve In mathematics, an elliptic curve is a smooth, projective, algebraic curve of genus one, on which there is a specified point . An elliptic curve is defined over a field and describes points in , the Cartesian product of with itself. If ...
s. 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 In number theory, the general number field sieve (GNFS) is the most efficient classical algorithm known for factoring integers larger than . Heuristically, its complexity for factoring an integer (consisting of bits) is of the form :\exp\left( ...
. The Lenstra elliptic-curve factorization is named after
Hendrik Lenstra Hendrik Willem Lenstra Jr. (born 16 April 1949, Zaandam) is a Dutch mathematician. Biography Lenstra received his doctorate from the University of Amsterdam in 1977 and became a professor there in 1978. In 1987 he was appointed to the faculty of ...
. 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
divisor In mathematics, a divisor of an integer n, also called a factor of n, is an integer m that may be multiplied by some integer to produce n. In this case, one also says that n is a multiple of m. An integer n is divisible or evenly divisible by ...
s 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 Linearity is the property of a mathematical relationship (''function'') that can be graphically represented as a straight line. Linearity is closely related to '' proportionality''. Examples in physics include rectilinear motion, the linear r ...
with the increase in the number of digits.


Algorithm

The Lenstra elliptic-curve factorization method to find a factor of a given natural number n works as follows: # Pick a random
elliptic curve In mathematics, an elliptic curve is a smooth, projective, algebraic curve of genus one, on which there is a specified point . An elliptic curve is defined over a field and describes points in , the Cartesian product of with itself. If ...
over \mathbb/n\mathbb, with equation of the form y^2 = x^3 + ax + b \pmod n together with a non-trivial
point Point or points may refer to: Places * Point, Lewis, a peninsula in the Outer Hebrides, Scotland * Point, Texas, a city in Rains County, Texas, United States * Point, the NE tip and a ferry terminal of Lismore, Inner Hebrides, Scotland * Point ...
P(x_0,y_0) on it. #:This can be done by first picking random x_0,y_0,a \in \mathbb/n\mathbb, and then setting b = y_0^2 - x_0^3 - ax_0\pmod n to assure the point is on the curve. # One can define ''Addition'' of two points on the curve, to define a
Group A group is a number of persons or things that are located, gathered, or classed together. Groups of people * Cultural group, a group whose members share the same cultural identity * Ethnic group, a group whose members share the same ethnic ide ...
. The addition laws are given in the article on elliptic curves. #:We can form repeated multiples of a point P: = P + \ldots + P \text. The addition formulae involve taking the modular slope of a chord joining P and Q, and thus division between residue classes modulo n, performed using the
extended Euclidean algorithm In arithmetic and computer programming, the extended Euclidean algorithm is an extension to the Euclidean algorithm, and computes, in addition to the greatest common divisor (gcd) of integers ''a'' and ''b'', also the coefficients of Bézout's ide ...
. In particular, division by some v \bmod n includes calculation of the \gcd(v,n). #: Assuming we calculate a slope of the form u/v with \gcd(u,v)=1, then if v = 0 \bmod n, the result of the point addition will be \infty, the point "at infinity" corresponding to the intersection of the "vertical" line joining P(x,y), P'(x,-y) and the curve. However, if \gcd(v,n) \neq 1, n, then the point addition will not produce a meaningful point on the curve; but, more importantly, \gcd(v,n) is a non-trivial factor of n. # Compute on the elliptic curve (\bmod n), where k 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 In mathematics, the factorial of a non-negative denoted is the product of all positive integers less than or equal The factorial also equals the product of n with the next smaller factorial: \begin n! &= n \times (n-1) \times (n-2) \t ...
B! for some not too large B. This can be done efficiently, one small factor at a time. Say, to get !, first compute , then ), then !), and so on. B is picked to be small enough so that B-wise point addition can be performed in reasonable time. #*If we finish all the calculations above without encountering non-invertible elements (\bmod n), it means that the elliptic curves' (modulo primes) order is not
smooth Smooth may refer to: Mathematics * Smooth function, a function that is infinitely differentiable; used in calculus and topology * Smooth manifold, a differentiable manifold for which all the transition maps are smooth functions * Smooth algebrai ...
enough, so we need to try again with a different curve and starting point. #*If we encounter a \gcd(v,n) \neq 1,n we are done: it is a non-trivial factor of 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_p\left frac,\sqrt\right/math>, in
L-notation ''L''-notation is an asymptotic notation analogous to big-O notation, denoted as L_n alpha,c/math> for a bound variable n tending to infinity. Like big-O notation, it is usually used to roughly convey the rate of growth of a function, such as the ...
.


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 \boxplus-addition are now genuine
groups A group is a number of persons or things that are located, gathered, or classed together. Groups of people * Cultural group, a group whose members share the same cultural identity * Ethnic group, a group whose members share the same ethnic ide ...
. If these groups have ''N''''p'' and ''Nq'' elements, respectively, then for any point ''P'' on the original curve, by Lagrange's theorem, is minimal such that kP=\infty on the curve modulo ''p'' implies that ''k'' divides ''N''''p''; moreover, N_p P=\infty. The analogous statement holds for the curve modulo ''q''. When the elliptic curve is chosen randomly, then ''N''''p'' and ''N''''q'' are random numbers close to and respectively (see below). Hence it is unlikely that most of the prime factors of ''N''''p'' and ''N''''q'' 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 factor 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 In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
to ''p'', by
Fermat's little theorem Fermat's little theorem states that if ''p'' is a prime number, then for any integer ''a'', the number a^p - a is an integer multiple of ''p''. In the notation of modular arithmetic, this is expressed as : a^p \equiv a \pmod p. For example, if = ...
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 prime In mathematics, a strong prime is a prime number with certain special properties. The definitions of strong primes are different in cryptography and number theory. Definition in number theory In number theory, a strong prime is a prime number t ...
s, for example. ECM gets around this obstacle by considering the
group A group is a number of persons or things that are located, gathered, or classed together. Groups of people * Cultural group, a group whose members share the same cultural identity * Ethnic group, a group whose members share the same ethnic ide ...
of a random
elliptic curve In mathematics, an elliptic curve is a smooth, projective, algebraic curve of genus one, on which there is a specified point . An elliptic curve is defined over a field and describes points in , the Cartesian product of with itself. If ...
over the
finite field In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field that contains a finite number of elements. As with any field, a finite field is a set on which the operations of multiplication, addition, subtr ...
Z''p'', rather than considering the
multiplicative group In mathematics and group theory, the term multiplicative group refers to one of the following concepts: *the group under multiplication of the invertible elements of a field, ring, or other structure for which one of its operations is referre ...
of Z''p'' which always has order  The order of the group of an elliptic curve over Z''p'' 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 A heuristic (; ), or heuristic technique, is any approach to problem solving or self-discovery that employs a practical method that is not guaranteed to be optimal, perfect, or rational, but is nevertheless sufficient for reaching an immediate, ...
probabilistic methods, the Canfield–Erdős–Pomerance theorem with suitably optimized parameter choices, and the
L-notation ''L''-notation is an asymptotic notation analogous to big-O notation, denoted as L_n alpha,c/math> for a bound variable n tending to infinity. Like big-O notation, it is usually used to roughly convey the rate of growth of a function, such as the ...
, 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''=(''x'', ''y'') is . Using ''s'' we can compute 2''A''. 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 In mathematics, particularly in the area of arithmetic, a modular multiplicative inverse of an integer is an integer such that the product is congruent to 1 with respect to the modulus .. In the standard notation of modular arithmetic this congru ...
of ''b''. If it does not exist, gcd(''n'',''b'') is a non-trivial factor of ''n''. First we compute 2''P''. We have so the coordinates of are and all numbers understood Just to check that this 2''P'' is indeed on the curve: Then we compute 3(2''P''). We have Using the
Euclidean algorithm In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an effi ...
: then then then then then Hence and working backwards (a version of the
extended Euclidean algorithm In arithmetic and computer programming, the extended Euclidean algorithm is an extension to the Euclidean algorithm, and computes, in addition to the greatest common divisor (gcd) of integers ''a'' and ''b'', also the coefficients of Bézout's ide ...
): Hence and Given this ''s'', we can compute the coordinates of 2(2''P''), 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 \boxplus 2P. 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 (\Z/n\Z)/\sim, first consider a 'normal'
projective space In mathematics, the concept of a projective space originated from the visual effect of perspective, where parallel lines seem to meet ''at infinity''. A projective space may thus be viewed as the extension of a Euclidean space, or, more generally ...
over ℝ: Instead of points, lines through the origin are studied. A line may be represented as a non-zero point (x,y,z), under an equivalence relation ~ given by: (x,y,z)\sim(x',y',z') ⇔ ∃ ''c'' ≠ 0 such that ''x' = cx'', ''y' = cy'' and ''z' = cz''. Under this equivalence relation, the space is called the projective plane \mathbb^2; points, denoted by (x:y:z), correspond to lines in a three-dimensional space that pass through the origin. Note that the point (0:0:0) 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 (''X'',''Y'',1)-plane, whilst the lines precisely parallel to this plane, having coordinates (''X,Y'',0), specify directions uniquely, as 'points at infinity' that are used in the affine (''X,Y'')-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 (\Z/n\Z)/\sim 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 (0:1:0). Let be a (positive) integer and consider the elliptic curve (a set of points with some structure on it) E(\Z/n\Z)=\. # Pick x_P,y_P,a \in \Z/n\Z with ≠ 0. # Calculate b = y_P^2 - x_P^3 - ax_P. The elliptic curve is then in Weierstrass form given by y^2 = x^3 + ax + b and by using projective coordinates the elliptic curve is given by the homogeneous equation ZY^2=X^3+aZ^2X+bZ^3. It has the point P=(x_P:y_P:1). # Choose an upperbound B \in \Z for this elliptic curve. Remark: You will only find factors if the group order of the elliptic curve over \Z/p\Z (denoted by \#E(\Z/p\Z)) is B-smooth, which means that all prime factors of \#E(\Z/p\Z) have to be less or equal to . # Calculate k=(1,\dots ,B). # Calculate k P := P + P + \cdots + P (''k'' times) in the ring E(\Z/n\Z). Note that if \#E(\Z/n\Z) is -smooth and is prime (and therefore \Z/n\Z is a field) that kP = (0:1:0). However, if only \#E(\Z/p\Z) is B-smooth for some divisor of , the product might not be (0:1:0) 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 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(x_1-x_2,n)=1. If P,Q are not (0:1:0) and distinct (otherwise addition works similarly, but is a little different), then addition works as follows: * To calculate: R = P + Q; P = (x_1:y_1:1), Q = (x_2:y_2:1), * \lambda =(y_1-y_2) (x_1-x_2)^, * x_3 = \lambda^2 - x_1 - x_2, * y_3 = \lambda(x_1-x_3) - y_1, * R = P + Q = (x_3:y_3:1). If addition fails, this will be due to a failure calculating \lambda. In particular, because (x_1-x_2)^ can not always be calculated if is not prime (and therefore \Z/n\Z is not a field). Without making use of \Z/n\Z being a field, one could calculate: * \lambda'=y_1-y_2, * x_3' = ^2 - x_1(x_1-x_2)^2 - x_2(x_1-x_2)^2, * y_3' = \lambda'(x_1(x_1-x_2)^2-x_3') - y_1(x_1-x_2)^3, * R = P + Q = (x_3'(x_1-x_2):y_3':(x_1-x_2)^3), and simplify if possible. 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.


Twisted Edwards curves

The use of
Edwards curve In mathematics, the Edwards curves are a family of elliptic curves studied by Harold Edwards in 2007. The concept of elliptic curves over finite fields is widely used in elliptic curve cryptography. Applications of Edwards curves to cryptograp ...
s 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 be a field in which 2 \neq 0, and let a,d \in k\setminus\ with a\neq d. Then the twisted Edwards curve E_ is given by ax^2+y^2=1+dx^2y^2. An Edwards curve is a twisted Edwards curve in which 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: :\. The addition law is given by :(e,f),(g,h) \mapsto \left(\frac,\frac\right). The point (0,1) is its neutral element and the inverse of (e,f) is (-e,f). The other representations are defined similar to how the projective Weierstrass curve follows from the affine. Any
elliptic curve In mathematics, an elliptic curve is a smooth, projective, algebraic curve of genus one, on which there is a specified point . An elliptic curve is defined over a field and describes points in , the Cartesian product of with itself. If ...
in Edwards form has a point of order 4. So the
torsion group In group theory, a branch of mathematics, a torsion group or a periodic group is a group in which every element has finite order. The exponent of such a group, if it exists, is the least common multiple of the orders of the elements. For examp ...
of an Edwards curve over \Q is isomorphic to either \Z/4\Z, \Z/8\Z, \Z/12\Z,\Z/2\Z \times \Z/4\Z or \Z/2\Z\times \Z/8\Z. The most interesting cases for ECM are \Z/12\Z and \Z/2\Z\times \Z/8\Z, 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 \Z/12\Z: * x^2+y^2=1+dx^2y^2 with point (a,b) where b \notin\, a^2=-(b^2+2b) and d=-(2b+1)/(a^2b^2) * x^2+y^2=1+dx^2y^2 with point (a,b) where a=\frac, b=-\frac and d=\frac, u\notin\. 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\times \Z/8\Z and \Z/2\Z\times \Z/4\Z may be more efficient at finding primes. (see top of page 30 for examples of such curves)


Stage 2

The above text is about the first stage of elliptic curve factorisation. There one hopes to find a prime divisor such that sP is the neutral element of E(\mathbb/p\mathbb). In the second stage one hopes to have found a prime divisor such that sP has small prime order in E(\mathbb/q\mathbb). We hope the order to be between B_1 and B_2, where B_1 is determined in stage 1 and B_2 is new stage 2 parameter. Checking for a small order of sP, can be done by computing (ls)P modulo for each prime .


GMP-ECM and EECM-MPFQ

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.


Hyperelliptic-curve method (HECM)

There are recent developments in using
hyperelliptic curve In algebraic geometry, a hyperelliptic curve is an algebraic curve of genus ''g'' > 1, given by an equation of the form y^2 + h(x)y = f(x) where ''f''(''x'') is a polynomial of degree ''n'' = 2''g'' + 1 > 4 or ''n'' = 2''g'' + 2 > 4 with ''n'' dist ...
s to factor integers. Cosset shows in his article (of 2010) that one can build a hyperelliptic curve with genus two (so a curve y^2 = f(x) with of degree 5), which gives the same result as using two "normal" elliptic curves at the same time. By making use of the Kummer surface, calculation is more efficient. The disadvantages of the hyperelliptic curve (versus an elliptic curve) are compensated by this alternative way of calculating. Therefore, Cosset roughly claims that using hyperelliptic curves for factorization is no worse than using elliptic curves.


Quantum version (GEECM)

Bernstein Bernstein is a common surname in the German language, meaning "amber" (literally "burn stone"). The name is used by both Germans and Jews, although it is most common among people of Ashkenazi Jewish heritage. The German pronunciation is , but in E ...
, Heninger, Lou, & Valenta suggest GEECM, a quantum version of ECM with Edwards curves.Bernstein D.J., Heninger N., Lou P., Valenta L. (2017
Post-quantum RSA
In: Lange T., Takagi T. (eds), ''Post-Quantum Cryptography''. PQCrypto 2017. Lecture Notes in Computer Science, vol 10346. Springer, Cham
It uses
Grover's algorithm In quantum computing, Grover's algorithm, also known as the quantum search algorithm, refers to a quantum algorithm for unstructured search that finds with high probability the unique input to a black box function that produces a particular output ...
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.


See also

*
UBASIC UBASIC is a freeware (public domain software without source code) BASIC interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing. Features UBASIC is a ready-to-run language that does not need to be s ...
for practical program (ECMX).


References

* * * * * * * * * * * * * *


External links


Factorization using the Elliptic Curve Method
a WebAssembly application which uses ECM and switches to the Self-Initializing Quadratic Sieve when it is faster.
GMP-ECM
an efficient implementation of ECM.

an easy client-server implementation that works with several factorization projects.
pyecm
a python implementation of ECM. Much faster with psyco and/or gmpy.
Distributed computing project yoyo@Home
Subproject ECM is a program for Elliptic Curve Factorization which is used by a couple of projects to find factors for different kind of numbers.
Lenstra Elliptic Curve Factorization algorithm source code
Simple C and GMP Elliptic Curve Factorization Algorithm source code.

An implementation of ECM using Edwards curves written with the MPFQ finite field library. {{number theoretic algorithms Integer factorization algorithms Finite fields