aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-02-26 17:12:06 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-02-26 17:12:06 +0100
commit7f1b8a358515b45d717c3c4b5baf2fbc0f568170 (patch)
tree3e51ad948d132ccad19da053bb083d8b760b4ec2 /README.md
downloadecm-7f1b8a358515b45d717c3c4b5baf2fbc0f568170.tar.gz
ecm-7f1b8a358515b45d717c3c4b5baf2fbc0f568170.zip
Initial commit
Diffstat (limited to 'README.md')
-rw-r--r--README.md63
1 files changed, 63 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..75f495a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,63 @@
1# Elliptic curve factorization method
2
3Slides and code for the a presentation about
4[Lenstra's elliptic-curve factorization](https://en.wikipedia.org/wiki/Lenstra_elliptic-curve_factorization).
5
6See also [this blog post](https://sebastiano.tronto.net/blog/2025-02-27-ecm).
7
8## Abstract
9
10Elliptic curves are mathematical objects that have both a geometric and an
11arithmetic side. They turn out to be useful for real-world applications
12because they sit in a sweet spot: they are complicated enough to have
13interesting and useful arithmetic properties, but simple enough to be
14implemented in software in an efficient way. For example, they are used in
15cryptographic schemes, such as the Elliptic-curve Diffie-Hellman scheme,
16to obtain greater security with smaller keys.
17
18After introducing elliptic curves and modular arithmetic, we will take a
19look at the elliptic curve factorization method (ECM), one of the most
20efficient method to find the prime factors of an integer number. We
21will see in practice how much faster this method is compared to a naive
22algorithm, and we'll see that the implementation of this method is not
23that hard at all.
24
25## Slides
26
27The slides are a single html file, `index.html`. They rely on a couple
28of external JavaScript libraries. They are also hosted
29[here](https://sebastiano.tronto.net/talks/ecm).
30
31## Code
32
33The folder `code/python` contains two files:
34
35* `ecm.py`: an implementation of the ECM algorithm.
36* `naive.py`: an implementation of the simple O(√n) algorithm for finding
37 a factor of a number, for comparison.
38
39To use any of the two, pass the number to factor as a command-line argument,
40for example:
41
42```
43$ ./ecm.py 255000007030000033
44255000007030000033 = 510000011 * 500000003
45```
46
47Some benchmarks (note: the ECM is randomized, the time can vary a lot):
48
49```
50$ time ./ecm.py 255000007030000033
51255000007030000033 = 510000011 * 500000003
52 0m01.45s real 0m01.43s user 0m00.01s system
53$ time ./naive.py 255000007030000033
54255000007030000033 = 500000003 * 510000011
55 0m26.62s real 0m26.50s user 0m00.01s system
56```
57
58### C++ code (experimental)
59
60The folder `code/cpp` contains an experimental implementation of the ECM
61algorithm in C++. It works, but it is very slow: it requires suppport
62for compile-time big integers, which I implement in an inefficient way. I
63may optimize this code in the future.

Generated with cgit - Back to sebastiano.tronto.net