ark-curves-cherry-picked/mnt4_298/src/curves/mod.rs
mnt4_298/src/curves/mod.rsRaw
1use ark_ec::models::mnt4::{MNT4Parameters, MNT4};
2use ark_ff::{biginteger::BigInteger320, field_new, Fp2};
3
4use crate::{Fq, Fq2, Fq2Parameters, Fq4Parameters, Fr};
5
6pub mod g1;
7pub mod g2;
8
9#[cfg(test)]
10mod tests;
11
12pub use self::{
13 g1::{G1Affine, G1Prepared, G1Projective},
14 g2::{G2Affine, G2Prepared, G2Projective},
15};
16
17pub type MNT4_298 = MNT4<Parameters>;
18
19pub struct Parameters;
20
21impl MNT4Parameters for Parameters {
22 const TWIST: Fp2<Self::Fp2Params> = field_new!(Fq2, FQ_ZERO, FQ_ONE);
23 // A coefficient of MNT4-298 G2 =
24 // ```
25 // mnt4298_twist_coeff_a = mnt4298_Fq2(mnt4298_G1::coeff_a * non_residue, mnt6298_Fq::zero());
26 // = (A_COEFF * NONRESIDUE, ZERO)
27 // = (34, ZERO)
28 // ```
29 #[rustfmt::skip]
30 const TWIST_COEFF_A: Fp2<Self::Fp2Params> = field_new!(Fq2,
31 G1_COEFF_A_NON_RESIDUE,
32 FQ_ZERO,
33 );
34
35 const ATE_LOOP_COUNT: &'static [u64] = &[993502997770534912, 5071219579242586943, 2027349];
36 const ATE_IS_LOOP_COUNT_NEG: bool = false;
37 const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger320 = BigInteger320([0x1, 0x0, 0x0, 0x0, 0x0]);
38 const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = false;
39 const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger320 =
40 BigInteger320([993502997770534913, 5071219579242586943, 2027349, 0, 0]);
41 type Fp = Fq;
42 type Fr = Fr;
43 type Fp2Params = Fq2Parameters;
44 type Fp4Params = Fq4Parameters;
45 type G1Parameters = self::g1::Parameters;
46 type G2Parameters = self::g2::Parameters;
47}
48
49// 34
50pub const G1_COEFF_A_NON_RESIDUE: Fq = field_new!(Fq, "34");
51pub const FQ_ZERO: Fq = field_new!(Fq, "0");
52pub const FQ_ONE: Fq = field_new!(Fq, "1");
53pub const FR_ZERO: Fr = field_new!(Fr, "0");
54pub const FR_ONE: Fr = field_new!(Fr, "1");