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