Elliptic curves and the ECM algorithm
Sebastiano Tronto
ALTEN Scientific Software Evening
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Part I: Numbers
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
What about division?
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
def extended_gcd(a, b):
if b == 0:
return a, 1, 0
g, x, y = extended_gcd(b, a % b)
return g, y, x - y*(a // b)
Division always works if
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Part II: Elliptic Curves
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
An elliptic curve is a curve with equation
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
# Computes p+q on the elliptic curve y^2 = x^3 + Ax + B
def ec_sum(p: Point, q: Point, A: double) -> Point:
if p.is_zero:
return q
if q.is_zero:
return p
if p.x == q.x and p.y == -q.y:
return Point(is_zero = True)
if p.x != q.x:
k = (p.y - q.y) / (p.x - q.x)
else:
k = (3 * p.x**2 + A) / (p.y + q.y)
new_x = k**2 - p.x - q.x
new_y = k * (p.x - new_x) - p.y
return Point(x = new_x, y = new_y)
@dataclass
class Point:
x: int = 0
y: int = 0
is_zero: bool = False
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Part III: The Elliptic Curve Factorization Method
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Every positive integer can be written as the product of prime numbers
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
# Returns the list of prime factors of n
def factorize(n: int) -> list:
if n == 1:
return []
if is_prime(n):
return [n]
f = find_factor(n)
return factorize(f) + factorize(n//f)
def find_factor(n: int) -> int:
for i in range(2,floor(sqrt(n))+1):
if n % i == 0:
return i
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
To find a factor of
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Q: Aren't we just computing the
A: Yes, but elliptic curve operations produce "good candidates" for these random numbers.
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Q: Can we do the same without elliptic curves?
A: Yes, with
Pollard's
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Q: Are there objects that are more complicated than elliptic curves and can make the method even faster?
A: Yes, there are higher-dimensional Abelian Varieties and other Algebraic Groups, but they are much harder (if not impossible) to implement efficiently.
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
More questions?
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |
Drinks!
Elliptic Curves and the ECM Algorithm | tronto.net/talks/ecm |