arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/mnt4_753/src/curves/mod.rs
mnt4_753/src/curves/mod.rsRaw
 1use ark_ec::models::mnt4::{MNT4Parameters, MNT4};
 2use ark_ff::{
 3    biginteger::{BigInt, BigInteger768},
 4    Field, Fp2, MontFp,
 5};
 6
 7use crate::{Fq, Fq2Config, Fq4Config, Fr};
 8
 9pub mod g1;
10pub mod g2;
11
12#[cfg(test)]
13mod tests;
14
15pub use self::{
16    g1::{G1Affine, G1Prepared, G1Projective},
17    g2::{G2Affine, G2Prepared, G2Projective},
18};
19
20pub type MNT4_753 = MNT4<Parameters>;
21
22pub struct Parameters;
23
24impl MNT4Parameters for Parameters {
25    const TWIST: Fp2<Self::Fp2Config> = Fp2::new(Fq::ZERO, Fq::ONE);
26    // A coefficient of MNT4-753 G2 =
27    // ```
28    // mnt4753_twist_coeff_a = mnt4753_Fq2(mnt4753_G1::coeff_a * non_residue, mnt6753_Fq::zero());
29    //  = (A_COEFF * NONRESIDUE, ZERO)
30    //  = (26, ZERO)
31    // ```
32    const TWIST_COEFF_A: Fp2<Self::Fp2Config> = Fp2::new(G1_COEFF_A_NON_RESIDUE, Fq::ZERO);
33    // https://github.com/o1-labs/snarky/blob/9c21ab2bb23874604640740d646a932e813432c3/snarkette/mnt4753.ml
34    const ATE_LOOP_COUNT: &'static [u64] = &[
35        8824542903220142080,
36        7711082599397206192,
37        8303354903384568230,
38        5874150271971943936,
39        9717849827920685054,
40        95829799234282493,
41    ];
42    const ATE_IS_LOOP_COUNT_NEG: bool = true;
43    const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger768 =
44        BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
45    const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = true;
46    const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInt::new([
47        8824542903220142079,
48        7711082599397206192,
49        8303354903384568230,
50        5874150271971943936,
51        9717849827920685054,
52        95829799234282493,
53        0,
54        0,
55        0,
56        0,
57        0,
58        0,
59    ]);
60    type Fp = Fq;
61    type Fr = Fr;
62    type Fp2Config = Fq2Config;
63    type Fp4Config = Fq4Config;
64    type G1Parameters = self::g1::Parameters;
65    type G2Parameters = self::g2::Parameters;
66}
67
68// 26
69pub const G1_COEFF_A_NON_RESIDUE: Fq = MontFp!("26");