ark-curves-cherry-picked/mnt4_298/src/curves/g1.rs
mnt4_298/src/curves/g1.rsRaw
1use crate::{Fq, Fr, FR_ONE};
2use ark_ec::{
3 mnt4,
4 models::{ModelParameters, SWModelParameters},
5};
6use ark_ff::field_new;
7
8pub type G1Affine = mnt4::G1Affine<crate::Parameters>;
9pub type G1Projective = mnt4::G1Projective<crate::Parameters>;
10pub type G1Prepared = mnt4::G1Prepared<crate::Parameters>;
11
12#[derive(Clone, Default, PartialEq, Eq)]
13pub struct Parameters;
14
15impl ModelParameters for Parameters {
16 type BaseField = Fq;
17 type ScalarField = Fr;
18}
19
20impl SWModelParameters for Parameters {
21 /// COEFF_A = 2
22 /// Reference: https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L116
23 #[rustfmt::skip]
24 const COEFF_A: Fq = field_new!(Fq, "2");
25
26 /// COEFF_B = 423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685
27 /// Reference: https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L117
28 #[rustfmt::skip]
29 const COEFF_B: Fq = field_new!(Fq, "423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685");
30
31 /// COFACTOR = 1
32 const COFACTOR: &'static [u64] = &[1];
33
34 /// COFACTOR^(-1) mod r =
35 /// 1
36 #[rustfmt::skip]
37 const COFACTOR_INV: Fr = FR_ONE;
38
39 /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
40 const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
41 (G1_GENERATOR_X, G1_GENERATOR_Y);
42}
43
44// Generator of G1
45// X = 60760244141852568949126569781626075788424196370144486719385562369396875346601926534016838,
46// Y = 363732850702582978263902770815145784459747722357071843971107674179038674942891694705904306,
47/// G1_GENERATOR_X
48/// Reference: https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L137
49#[rustfmt::skip]
50pub const G1_GENERATOR_X: Fq = field_new!(Fq, "60760244141852568949126569781626075788424196370144486719385562369396875346601926534016838");
51
52/// G1_GENERATOR_Y
53/// Reference: https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L138
54#[rustfmt::skip]
55pub const G1_GENERATOR_Y: Fq = field_new!(Fq, "363732850702582978263902770815145784459747722357071843971107674179038674942891694705904306");