| Crates.io | polynomials-ecc |
| lib.rs | polynomials-ecc |
| version | 0.1.1 |
| created_at | 2025-11-21 01:15:35.25294+00 |
| updated_at | 2025-11-22 19:13:07.875639+00 |
| description | A library for operating on polynomials over the BLS12-381 |
| homepage | |
| repository | https://github.com/xevisalle/polynomials-ecc |
| max_upload_size | |
| id | 1942913 |
| size | 20,193 |
This library allows to operate on polynomials over the BLS12-381. In particular, it allows to perform evaluations and interpolations using FFTs. It also offers tools such as efficient multi scalar multiplication, using the blst library as a backend.
DISCLAIMER: the code in this repository has NOT went through an exhaustive security review. Use at your own risk.
use polynomials_ecc::{Domain, Polynomial};
use bls12_381::Scalar;
use rand::rngs::OsRng;
use ff::Field;
// Define our domain of size n = 2^14
let domain = Domain::new(14);
// Create an array of random coefficients
let mut coeffs = vec![];
for _ in 0..10000 {
coeffs.push(Scalar::random(&mut OsRng));
}
// Define our polynomial
let polynomial = Polynomial::new(coeffs);
// Evaluate using the FFT
let evaluations = polynomial.evaluate(&domain);
// Interpolate using the IFFT
let polynomial_p = evaluations.interpolate(&domain);