ark-curves-cherry-picked/mnt6_753/src/curves/mod.rs
mnt6_753/src/curves/mod.rsRaw
1use ark_ec::models::{
2 mnt6::{MNT6Parameters, MNT6},
3 SWModelParameters,
4};
5use ark_ff::{biginteger::BigInteger768, field_new, Fp3};
6
7use crate::{Fq, Fq3, Fq3Parameters, Fq6Parameters, 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<Parameters>;
21
22pub struct Parameters;
23
24impl MNT6Parameters for Parameters {
25 const TWIST: Fp3<Self::Fp3Params> = field_new!(Fq3, 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 #[rustfmt::skip]
33 const TWIST_COEFF_A: Fp3<Self::Fp3Params> = field_new!(Fq3,
34 FQ_ZERO,
35 FQ_ZERO,
36 g1::Parameters::COEFF_A,
37 );
38 // https://github.com/o1-labs/snarky/blob/9c21ab2bb23874604640740d646a932e813432c3/snarkette/mnt6753.ml
39 const ATE_LOOP_COUNT: &'static [u64] = &[
40 8824542903220142080,
41 7711082599397206192,
42 8303354903384568230,
43 5874150271971943936,
44 9717849827920685054,
45 95829799234282493,
46 ];
47 const ATE_IS_LOOP_COUNT_NEG: bool = false;
48 const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger768 =
49 BigInteger768([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
50 const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = false;
51 const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInteger768([
52 8824542903220142080,
53 7711082599397206192,
54 8303354903384568230,
55 5874150271971943936,
56 9717849827920685054,
57 95829799234282493,
58 0,
59 0,
60 0,
61 0,
62 0,
63 0,
64 ]);
65 type Fp = Fq;
66 type Fr = Fr;
67 type Fp3Params = Fq3Parameters;
68 type Fp6Params = Fq6Parameters;
69 type G1Parameters = self::g1::Parameters;
70 type G2Parameters = self::g2::Parameters;
71}
72
73pub const FQ_ZERO: Fq = field_new!(Fq, "0");
74pub const FQ_ONE: Fq = field_new!(Fq, "1");
75pub const FR_ZERO: Fr = field_new!(Fr, "0");
76pub const FR_ONE: Fr = field_new!(Fr, "1");