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