#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::suspicious_arithmetic_impl)]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(any(test, feature = "std"))]
#[macro_use]
extern crate std;
pub use elliptic_curve;
pub use ff;
#[cfg(feature = "groups")]
pub use group;
#[cfg(test)]
#[cfg(feature = "groups")]
mod tests;
#[macro_use]
mod util;
pub mod notes {
pub mod design;
pub mod serialization;
}
mod scalar;
#[cfg(target_arch = "wasm32")]
pub use scalar::run_test_wasm;
pub use scalar::{Scalar, ScalarLe};
#[cfg(all(feature = "groups", not(feature = "expose-fields")))]
mod fp;
#[cfg(feature = "expose-fields")]
pub mod fp;
#[cfg(all(feature = "groups", not(feature = "expose-fields")))]
mod fp2;
#[cfg(feature = "expose-fields")]
pub mod fp2;
#[cfg(feature = "groups")]
mod g1;
#[cfg(feature = "groups")]
mod g2;
#[cfg(feature = "groups")]
pub use g1::{G1Affine, G1Projective};
#[cfg(feature = "expose-fields")]
pub use g1::{G1Compressed, G1Uncompressed};
#[cfg(feature = "groups")]
pub use g2::{G2Affine, G2Projective};
#[cfg(feature = "expose-fields")]
pub use g2::{G2Compressed, G2Uncompressed};
mod fp12;
mod fp6;
use elliptic_curve::{
bigint::{ArrayEncoding, U384},
consts::U48,
point::PointCompression,
Curve, FieldBytes, FieldBytesEncoding, PrimeCurve,
};
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd)]
pub struct Bls12381G1;
unsafe impl Send for Bls12381G1 {}
unsafe impl Sync for Bls12381G1 {}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd)]
pub struct Bls12381G2;
impl Curve for Bls12381G1 {
type FieldBytesSize = U48;
type Uint = U384;
const ORDER: U384 = U384::from_be_hex("0000000000000000000000000000000073eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001");
}
impl PrimeCurve for Bls12381G1 {}
impl PointCompression for Bls12381G1 {
const COMPRESS_POINTS: bool = true;
}
impl FieldBytesEncoding<Bls12381G1> for U384 {
fn decode_field_bytes(field_bytes: &FieldBytes<Bls12381G1>) -> Self {
U384::from_be_byte_array(*field_bytes)
}
fn encode_field_bytes(&self) -> FieldBytes<Bls12381G1> {
self.to_be_byte_array()
}
}
impl Curve for Bls12381G2 {
type FieldBytesSize = U48;
type Uint = U384;
const ORDER: U384 = U384::from_be_hex("0000000000000000000000000000000073eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001");
}
impl PrimeCurve for Bls12381G2 {}
impl PointCompression for Bls12381G2 {
const COMPRESS_POINTS: bool = true;
}
impl FieldBytesEncoding<Bls12381G2> for U384 {
fn decode_field_bytes(field_bytes: &FieldBytes<Bls12381G2>) -> Self {
U384::from_be_byte_array(*field_bytes)
}
fn encode_field_bytes(&self) -> FieldBytes<Bls12381G2> {
self.to_be_byte_array()
}
}
#[cfg(feature = "groups")]
const BLS_X: u64 = 0xd201_0000_0001_0000;
#[cfg(feature = "groups")]
const BLS_X_IS_NEGATIVE: bool = true;
#[cfg(feature = "pairings")]
mod pairings;
#[cfg(feature = "pairings")]
pub use pairings::{pairing, Bls12, Gt, MillerLoopResult};
#[cfg(feature = "pairings")]
pub use pairings::{multi_miller_loop, G2Prepared};
mod isogeny;