This module provides functionality to construct Barreto-Naehrig (BN) curves, following the procedure described in [BN05]. The module contains three files:
-
bn_curves.py
, which contains the algorithm to construct Barreto-Naehrig curves; -
bn_curves_examples.py
, which contains code examples; -
bn_curves_tests.py
, which contains unit tests.
Throughout, q denotes the prime size of the base field; t denotes the trace of Frobenius; r denotes the prime size of the group; k denotes the embedding degree; D denotes the (negative) fundamental discriminant.
The main method in bn_curves.py
is
make_curve(num_bits, num_curves=1)
It outputs a list of the first num_curves BN curves of prime order at least 2num_bits.
The code example in bn_curves_examples.py
shows how to find 10 BN curves with a prime order that is at least 2100.
The test in bn_curves_tests.py
runs the algorithm on random bit-sizes and checks validity of the output.