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::{short_weierstrass::SWCurveConfig, CurveConfig},
 4};
 5use ark_ff::{Field, MontFp};
 6
 7use crate::{Fq, Fr};
 8
 9pub type G1Affine = mnt4::G1Affine<crate::Config>;
10pub type G1Projective = mnt4::G1Projective<crate::Config>;
11pub type G1Prepared = mnt4::G1Prepared<crate::Config>;
12
13#[derive(Clone, Default, PartialEq, Eq)]
14pub struct Config;
15
16impl CurveConfig for Config {
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 SWCurveConfig for Config {
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!("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!("423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685");
36
37    /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
38    const GENERATOR: G1Affine = G1Affine::new_unchecked(G1_GENERATOR_X, G1_GENERATOR_Y);
39}
40
41// Generator of G1
42// X = 60760244141852568949126569781626075788424196370144486719385562369396875346601926534016838,
43// Y = 363732850702582978263902770815145784459747722357071843971107674179038674942891694705904306,
44/// G1_GENERATOR_X
45/// Reference: <https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L137>
46pub const G1_GENERATOR_X: Fq = MontFp!(
47    "60760244141852568949126569781626075788424196370144486719385562369396875346601926534016838"
48);
49
50/// G1_GENERATOR_Y
51/// Reference: <https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L138>
52pub const G1_GENERATOR_Y: Fq = MontFp!(
53    "363732850702582978263902770815145784459747722357071843971107674179038674942891694705904306"
54);