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