arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/mnt6_753/src/curves/mod.rs
mnt6_753/src/curves/mod.rsRaw
 1use ark_ec::models::{
 2    mnt6::{MNT6Config, MNT6},
 3    short_weierstrass::SWCurveConfig,
 4};
 5use ark_ff::{biginteger::BigInteger768, BigInt, Field, Fp3};
 6
 7use crate::{Fq, Fq3Config, Fq6Config, 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 MNT6_753 = MNT6<Config>;
21
22pub struct Config;
23
24impl MNT6Config for Config {
25    const TWIST: Fp3<Self::Fp3Config> = Fp3::new(Fq::ZERO, Fq::ONE, Fq::ZERO);
26    // A coefficient of MNT6-753 G2 =
27    // ```
28    // mnt6753_twist_coeff_a = mnt6753_Fq3(mnt6753_Fq::zero(), mnt6753_Fq::zero(),
29    //                                  mnt6753_G1::coeff_a);
30    //  = (ZERO, ZERO, A_COEFF);
31    // ```
32    const TWIST_COEFF_A: Fp3<Self::Fp3Config> = Fp3::new(Fq::ZERO, Fq::ZERO, g1::Config::COEFF_A);
33
34    // https://github.com/o1-labs/snarky/blob/9c21ab2bb23874604640740d646a932e813432c3/snarkette/mnt6753.ml
35    const ATE_LOOP_COUNT: &'static [i8] = &[
36        1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, -1, 0,
37        -1, 0, -1, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1,
38        0, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 1, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, -1, 0,
39        0, -1, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 1, 0, 0, -1, 0, -1, 0, 1, 0, 1, 0, 0, 0, 0,
40        0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 1, 0, 0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, -1, 0, -1,
41        0, 0, 1, 0, 0, 1, 0, -1, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 1, 0, 1, 0, 0, -1, 0, 0, -1,
42        0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 0, -1, 0, 1, 0, 0, 0, -1, 0, 0,
43        -1, 0, 0, -1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
44        -1, 0, 0, 0, 1, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 1, 0, -1, 0, 1, 0, 0, -1, 0, -1, 0, -1, 0,
45        0, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0, 0, 1, 0, 1, 0, 0, -1, 0, 0, 1,
46        0, -1, 0, -1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, -1, 0, -1, 0, 0, 0, 0, 1, 0, 0,
47        0, -1, 0, 1, 0, 1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0,
48        0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
49        0, 0, 0,
50    ];
51    const ATE_IS_LOOP_COUNT_NEG: bool = false;
52    const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger768 =
53        BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
54    const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = false;
55    const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInt::new([
56        8824542903220142080,
57        7711082599397206192,
58        8303354903384568230,
59        5874150271971943936,
60        9717849827920685054,
61        95829799234282493,
62        0,
63        0,
64        0,
65        0,
66        0,
67        0,
68    ]);
69    type Fp = Fq;
70    type Fr = Fr;
71    type Fp3Config = Fq3Config;
72    type Fp6Config = Fq6Config;
73    type G1Config = self::g1::Config;
74    type G2Config = self::g2::Config;
75}