Accelerated operations for BN254
Project description
pybn254
Accelerated operations for BN254 using libff and libfqfft.
Supported operations:
- Multi-exponentiation in G1
- FFT
- Multiply polynomials
Install for pip
pip install pybn254
Build
Install python dependencies
Dependencies:
- py_ecc
Compile native dependencies
MacOS
- Install Homebrew
- Install dependencies -
brew install gmp boost cmake openssl libomp
- Go into
libff
and runmake all
This should create libff.dylib
in the root folder.
Ubuntu
- Install dependencies -
sudo apt-get install build-essential git libboost-all-dev cmake libgmp3-dev libssl-dev pkg-config
- Go into
libff
and runmake all
This should create libff.so
in the root folder.
Test
You can use the following script to test things out:
import pybn254
from py_ecc.optimized_bn128 import add, multiply, pairing
from py_ecc.fields import optimized_bn128_FQ as FQ
p = [(FQ(1), FQ(2), FQ(1))]
e = [5]
p1 = [1, 2, 3]
p2 = [4, 5, 6]
print(pybn254.multiexp(p,e))
# run fft, not an inverse, not on a coset
print(pybn254.fft(p1, False, False))
print(pybn254.multiply_polynomials(p1, p2))
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
No source distribution files available for this release.
See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for pybn254-1.0.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0cb4c30630264ae14df6531418d120d23b66c218b9cc5f0512462ce620adec7 |
|
MD5 | 42403fd1749dc6a36e5007f5d5213378 |
|
BLAKE2b-256 | f1654285f8d170e82838452e025216a7b65ec572b7d8f65af2e4d3b177cdd430 |
Close
Hashes for pybn254-1.0.5-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 474f9edab085899112a69451384fb829092fc8ff744b9bb52d32ed7b92b201f8 |
|
MD5 | a13e56fa3fe59f958145f444e292ba79 |
|
BLAKE2b-256 | bcdd600c1ad68d245a56fdad4b585cd360a17f9734204b5b6b346e50ca5c35f7 |
Close
Hashes for pybn254-1.0.5-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c983fed4b93afd9684d39ebf760810add683b6cf31d74a4a959f650c1d19cb3a |
|
MD5 | b5bd4edbce27066de748a79190cabb19 |
|
BLAKE2b-256 | c10c043d187cd9069ae5e690df44329227b3663f5ef8478bbca2d1f88a2ae94a |