ecfactory: A SageMath Library for Constructing Elliptic Curves
The ecfactory library is developed by the SCIPR Lab project and contributors (see AUTHORS file) and is released under the MIT License (see LICENSE file). The library implements algorithms to construct elliptic curves with certain desired properties; specifically, it provides the following functionality.
- Complex Multiplication method
- Cocks-Pinch method
- Dupont-Enge-Morain method
- Solver for Pell equations
- Miyaji-Nakabayashi-Takano curves
- Barreto-Naehrig curves
- Elliptic-curve chains (via the Cocks-Pinch method)
- Elliptic-curve cycles (via MNT curves)
Each of the above is packaged as a Python module in a corresponding subfolder under the ecfactory folder.
Throughout, a curve E is specified as a tuple (q,t,r,k,D) where: q is the prime size of the base field; t is the trace of Frobenius; r is the prime size of the subgroup (which can be the size of the entire group); k is the embedding degree; and D is the (negative) fundamental discriminant. From the tuple (q,t,r,k,D), the curve equation can be found using the Complex Multiplication method.
The library requires a working SageMath installation, and has been tested on SageMath version 6.8 and 7.2.
To install, add the library to the SAGE_PATH environment variable:
$ export SAGE_PATH="path/to/library/:$SAGE_PATH"
To import and use the library, write
Methods can now be invoked as
To import only one module, write
import ecfactory.module_name as other_name
Methods can now be invoked more concisely as
import ecfactory.dupont_enge_morain as dem dem.run(50,5)
Each subfolder contains a readme, code examples, and unit tests. The methods are described in the readme, and the code examples show how to run the relevant methods. Many of the algorithms and tests are probabilistic, and the random seed can be set using
utils module contains global functions that filter the curves found by all algorithms. See the utils folder for more details.