Skip to main content

Pure-Python library that implements operations over the BN(2,254) pairing-friendly curve.

Usage Examples

This library is available as a package on PyPI. Usage examples are provided below:

from bn254.curve import r as scalar_upper_bound
from bn254.ecp import generator as base_point
from bn254.ecp2 import generator as random_point
from bn254.big import invmodp, rand
from bn254.pair import e

P = random_point()
G = base_point()
s = rand(scalar_upper_bound)
t = rand(scalar_upper_bound)
s_inv = invmodp(s, scalar_upper_bound)
b = s_inv * t

assert(
    e(t*P, G) == e(s*P, b*G)
)

Acknowledgments

This product includes software developed at the Apache Software Foundation. See file headers for notices. You may find archives of the original Apache Milagro Cryptographic Library documentation and source files (some of which were included in a modified form within this library) at the links below:

The authors also acknowledge learning about the original Apache Milagro Cryptographic Library via the use of its source code within the MIRACL Core Cryptographic Library.

Metadata

Release files for bn254 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bn254 0.1.2
File Size Uploaded
bn254-0.1.2.tar.gz 19.4 kB Details

Release files / bn254-0.1.2.tar.gz

Download URL bn254-0.1.2.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
113208d61601b9c48a2eb24156bcedcf81e84668584bc723aacf43ac59c3a62a
BLAKE2b-256 checksum
How to use checksums
13c0516bc8983b913b12eec80ca038137936f5dccf174a7cbc840a43726ceb10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page