ark-curves-cherry-picked/bls12_377/src/curves/g1.rs
bls12_377/src/curves/g1.rsRaw
1use ark_ec::models::{ModelParameters, SWModelParameters};
2use ark_ff::{field_new, Zero};
3
4use crate::{
5 fields::{FQ_ONE, FQ_ZERO},
6 Fq, Fr,
7};
8
9#[derive(Clone, Default, PartialEq, Eq)]
10pub struct Parameters;
11
12impl ModelParameters for Parameters {
13 type BaseField = Fq;
14 type ScalarField = Fr;
15}
16
17impl SWModelParameters for Parameters {
18 /// COEFF_A = 0
19 const COEFF_A: Fq = FQ_ZERO;
20
21 /// COEFF_B = 1
22 #[rustfmt::skip]
23 const COEFF_B: Fq = FQ_ONE;
24
25 /// COFACTOR = (x - 1)^2 / 3 = 30631250834960419227450344600217059328
26 const COFACTOR: &'static [u64] = &[0x0, 0x170b5d4430000000];
27
28 /// COFACTOR_INV = COFACTOR^{-1} mod r
29 /// = 5285428838741532253824584287042945485047145357130994810877
30 #[rustfmt::skip]
31 const COFACTOR_INV: Fr = field_new!(Fr, "5285428838741532253824584287042945485047145357130994810877");
32
33 /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
34 const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
35 (G1_GENERATOR_X, G1_GENERATOR_Y);
36
37 #[inline(always)]
38 fn mul_by_a(_: &Self::BaseField) -> Self::BaseField {
39 Self::BaseField::zero()
40 }
41}
42
43/// G1_GENERATOR_X =
44/// 81937999373150964239938255573465948239988671502647976594219695644855304257327692006745978603320413799295628339695
45#[rustfmt::skip]
46pub const G1_GENERATOR_X: Fq = field_new!(Fq, "81937999373150964239938255573465948239988671502647976594219695644855304257327692006745978603320413799295628339695");
47
48/// G1_GENERATOR_Y =
49/// 241266749859715473739788878240585681733927191168601896383759122102112907357779751001206799952863815012735208165030
50#[rustfmt::skip]
51pub const G1_GENERATOR_Y: Fq = field_new!(Fq, "241266749859715473739788878240585681733927191168601896383759122102112907357779751001206799952863815012735208165030");