halo2curves_axiom/bls12_381/mod.rs
1//! # `bls12_381`
2//!
3//! This crate provides an implementation of the BLS12-381 pairing-friendly elliptic
4//! curve construction.
5//!
6//! * **This implementation has not been reviewed or audited. Use at your own risk.**
7//! * This implementation targets Rust `1.36` or later.
8//! * This implementation does not require the Rust standard library.
9//! * All operations are constant time unless explicitly noted.
10//! Source: <https://github.com/privacy-scaling-explorations/bls12_381>
11
12// Catch documentation errors caused by code changes.
13#![allow(clippy::too_many_arguments)]
14#![allow(clippy::many_single_char_names)]
15// This lint is described at
16// https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_arithmetic_impl
17// In our library, some of the arithmetic involving extension fields will necessarily
18// involve various binary operators, and so this lint is triggered unnecessarily.
19#![allow(clippy::suspicious_arithmetic_impl)]
20
21// #[macro_use]
22// mod util;
23
24mod scalar;
25
26pub use fp::Fp as Fq;
27pub use scalar::Scalar as Fr;
28
29use scalar::Scalar;
30
31mod fp;
32mod fp2;
33mod g1;
34mod g2;
35
36use g1::G1Projective;
37use g2::G2Projective;
38
39pub use g1::{G1Affine, G1Projective as G1};
40pub use g2::{G2Affine, G2Projective as G2};
41
42mod fp12;
43mod fp6;
44
45pub use fp12::{Fp12 as Fq12, FROBENIUS_COEFF_FQ12_C1};
46pub use fp2::Fp2 as Fq2;
47pub use fp6::Fp6 as Fq6;
48
49// The BLS parameter x for BLS12-381 is -0xd201000000010000
50pub const BLS_X: u64 = 0xd201_0000_0001_0000;
51pub const BLS_X_IS_NEGATIVE: bool = true;
52
53mod pairings;
54
55pub use pairings::{multi_miller_loop, G2Prepared};
56pub use pairings::{pairing, Bls12, Gt, MillerLoopResult};
57
58mod endo;
59
60pub(crate) use digest::generic_array;
61pub mod hash_to_curve;
62
63#[cfg(test)]
64mod tests;