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 crate::{Fq, Fr, FR_ONE};
 2use ark_ec::{
 3    mnt4,
 4    models::{ModelParameters, SWModelParameters},
 5};
 6use ark_ff::{biginteger::BigInteger320, 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, BigInteger320([
25            3568597988870129848,
26            15257338106490985450,
27            10069779447956199041,
28            5922375556522222383,
29            3858029504390,
30    ]));
31
32    /// COEFF_B = 423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685
33    /// Reference: https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L117
34    #[rustfmt::skip]
35    const COEFF_B: Fq = field_new!(Fq, BigInteger320([
36            7842808090366692145,
37            288200302308193399,
38            4162060950790347941,
39            5488589108190218591,
40            1553456013645,
41    ]));
42
43    /// COFACTOR = 1
44    const COFACTOR: &'static [u64] = &[1];
45
46    /// COFACTOR^(-1) mod r =
47    /// 1
48    #[rustfmt::skip]
49    const COFACTOR_INV: Fr = FR_ONE;
50
51    /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
52    const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
53        (G1_GENERATOR_X, G1_GENERATOR_Y);
54}
55
56// Generator of G1
57// X = 60760244141852568949126569781626075788424196370144486719385562369396875346601926534016838,
58// Y = 363732850702582978263902770815145784459747722357071843971107674179038674942891694705904306,
59/// G1_GENERATOR_X
60/// Reference: https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L137
61#[rustfmt::skip]
62pub const G1_GENERATOR_X: Fq = field_new!(Fq, BigInteger320([
63    6046301378120906932,
64    15105298306031900263,
65    15757949605695610691,
66    6113949277267426050,
67    3063081829217,
68]));
69
70/// G1_GENERATOR_Y
71/// Reference: https://github.com/scipr-lab/libff/blob/c927821ebe02e0a24b5e0f9170cec5e211a35f08/libff/algebra/curves/mnt/mnt4/mnt4_init.cpp#L138
72#[rustfmt::skip]
73pub const G1_GENERATOR_Y: Fq = field_new!(Fq, BigInteger320([
74    8798367863963590781,
75    9770379341721339603,
76    17697354471293810920,
77    15252694996423733496,
78    3845520398052,
79]));