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, BigInt, Fp2, MontFp, QuadExt};
3
4use crate::{Fq, Fq2Config, Fq4Config, 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::Fp2Config> = QuadExt!(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 const TWIST_COEFF_A: Fp2<Self::Fp2Config> = QuadExt!(G1_COEFF_A_NON_RESIDUE, FQ_ZERO);
30
31 const ATE_LOOP_COUNT: &'static [u64] = &[993502997770534912, 5071219579242586943, 2027349];
32 const ATE_IS_LOOP_COUNT_NEG: bool = false;
33 const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger320 = BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0]);
34 const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = false;
35 const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger320 =
36 BigInt::new([993502997770534913, 5071219579242586943, 2027349, 0, 0]);
37 type Fp = Fq;
38 type Fr = Fr;
39 type Fp2Config = Fq2Config;
40 type Fp4Config = Fq4Config;
41 type G1Parameters = self::g1::Parameters;
42 type G2Parameters = self::g2::Parameters;
43}
44
45// 34
46pub const G1_COEFF_A_NON_RESIDUE: Fq = MontFp!(Fq, "34");
47pub const FQ_ZERO: Fq = MontFp!(Fq, "0");
48pub const FQ_ONE: Fq = MontFp!(Fq, "1");
49pub const FR_ZERO: Fr = MontFp!(Fr, "0");
50pub const FR_ONE: Fr = MontFp!(Fr, "1");