Python bindings for the BN254/256 pairing-friendly curve supported by the MCl library.
Project description
Python library that serves as an API for the BN254/256 pairing-friendly curve implemented in MCl in C.
Package Installation and Usage
The package is available on PyPI:
pip install mclbn256
The library can be imported in the usual ways:
import mclbn256 # All required data structures from mclbn256 import mclbn256 # Extended attributes, internals, classes, test methods
Examples
This library supports concise construction of elliptic curve points (groups G1 and G2) and scalars (group Fr):
from mclbn256 import G1, G2, Fr >>> p = G1().hash("some row") >>> q = G2().hash("another row") >>> p.valid() True >>> q.valid() True >>> s = Fr(6) >>> t = Fr(857462736753) >>> ((p * s) @ (q * t)) == (p @ (q * s * t)) True >>> ((p * s * ~t) @ (q * t)) == (p @ (q * s)) True >>> ((p * s) @ q) == ((p * ~t) @ (q * s * t)) True
Data structures for the relevant curve subgroups and finite fields are included as well:
>>> len(Fr().randomize().serialize()) 32 >>> len(G1().randomize().serialize()) 32 >>> len(G2().randomize().serialize()) 64 >>> len((G1().randomize() @ G2().randomize()).serialize()) <= 384 True
Please see the package oblivious (which extends this package) for more examples of how to use the BN254 curve.
Contributions
In order to contribute to the source code, open an issue or submit a pull request on the GitHub page for this library.
Versioning
Beginning with version 0.1.0, the version number format for this library and the changes to the library associated with version number increments conform with Semantic Versioning 2.0.0.
Naming Notes
BN-256 was an old name for the BarretoNaehrig(2,254) Weierstrass curve,
when it was though to have close to 256 bits of security. It has since
been estimated to have at least 90 bits of security (compared to
symmetric ciphers) and is now more commonly refered to by BN254, after
the number of bits in its prime modulus. Specifically, mclbn256
is the
name of the subset of the MCl library containing the support for this
curve.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for mclbn256-0.4.0-cp310-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40ea7ff2828707dd88912b8858ac899255e36923449a017a222457226f2cf243 |
|
MD5 | 0f945b2f0d052dfda821a29f6740e24a |
|
BLAKE2b-256 | 57b9b7616fe2f795cd46ca150d28953eb2f7ae31d2b17fcbffb3f26fb9d10e0f |
Hashes for mclbn256-0.4.0-cp310-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a583032744e55d8714772d8fe3fe943dee8fe775f2cb1a009d1c41d83fe48821 |
|
MD5 | 89e8f74782a3c694a0520b6ccd45b35b |
|
BLAKE2b-256 | defc67aed6da4d6aeea1b93575c403b2802f143f49915d85e43e23f8a653d853 |
Hashes for mclbn256-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8806441b3dd135f5dd12aae95ae3777af3f6b39bc25df1dfbd0abad8fb63c9bf |
|
MD5 | b051f9f56b0d6abb51f517043fa89657 |
|
BLAKE2b-256 | 8543e0b8963dd7d7fdd81cfffe7e31a45ac9dcf1a7ed14a54e620dd23a509fe5 |
Hashes for mclbn256-0.4.0-cp310-abi3-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc66629f229551b2c12c81b50daf6d0ece76c7c33eb50bb5d2d90357a38c09bd |
|
MD5 | 2b6cc746cc073b107466ba8a9edfcc14 |
|
BLAKE2b-256 | 1c1283ad77ffc969203d623aa1b0c85a42b21bf09239acdbf0bcfd93044c7e4c |
Hashes for mclbn256-0.4.0-cp310-abi3-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b00b8b3621bcf688784017c550d9f9df612bab01346fb423832d355baf931dcb |
|
MD5 | aab2cae44140fb40ba25cf16a5d3f9ae |
|
BLAKE2b-256 | 08ad2cdd6c63c5dece4d0cc56959c7e623d30f8c2413c32e3e25c73a5409bcc0 |
Hashes for mclbn256-0.4.0-cp310-abi3-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6302abd449378e62efa2ddb7c638339394729672bb229620245afd3c18516568 |
|
MD5 | fa26e1943935dd61475011f1d401702a |
|
BLAKE2b-256 | 1cd2c5d44347ea74dfbbf17582b6196423d5fa16b853bce2bec6f80b16ce4fc5 |
Hashes for mclbn256-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d53abcb116254ec776d00d6a3282b3b765e511ad71c9f1819548b6ad8dcf2040 |
|
MD5 | eee52a9570cb73b511c028b40c442d36 |
|
BLAKE2b-256 | c4d92759bcac8f808350dd1c9c7dc7028733ea58ad8e185ff949a5e081634db4 |
Hashes for mclbn256-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 159db78b82dceaf9e5fa6f851d6b1c872726f1863f1f09f852182c3e320bc002 |
|
MD5 | 5d1cdf347014bf43ecde24b0208b7ae8 |
|
BLAKE2b-256 | 93b6910fca7b153797bf886d1d00322ec6dc8bcc655f55e8dd4d1f38a8955a6c |
Hashes for mclbn256-0.4.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34698ffc026474863ba503fa515cbb93b4cecb8934af9971d68fa492e5dd00d3 |
|
MD5 | 4fdf52861f41074490f6e54bf7750e4c |
|
BLAKE2b-256 | b281f3b80b41a3a450b9b172c73b6ccc509b111ce04e9fc4b8df84919246d9d1 |
Hashes for mclbn256-0.4.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 704a03027ffed77a9193b0ef244e24bd8567a2dc81bf6b825f0a52491ef2b14a |
|
MD5 | 75ec1c74415c797341923bd77e57b102 |
|
BLAKE2b-256 | ab5bad2cc2d52ea07cd9bae6255644911d3390c2464f9f400554a804d5963452 |
Hashes for mclbn256-0.4.0-cp36-abi3-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63a203fef872beeeecdb1fd8094d02f5d3967413fd875b86bc56c08da1355db0 |
|
MD5 | 6c3baf9cbaf4d850d329731e0a809fcb |
|
BLAKE2b-256 | 6ac2caf9d6d3bc4a78338c5caf3f8ff13d272ff65a23c80e71af404497601459 |