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::{biginteger::BigInteger768, 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_753 = 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-753 G2 =
24 // ```
25 // mnt4753_twist_coeff_a = mnt4753_Fq2(mnt4753_G1::coeff_a * non_residue, mnt6753_Fq::zero());
26 // = (A_COEFF * NONRESIDUE, ZERO)
27 // = (26, 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 // https://github.com/o1-labs/snarky/blob/9c21ab2bb23874604640740d646a932e813432c3/snarkette/mnt4753.ml
35 const ATE_LOOP_COUNT: &'static [u64] = &[
36 8824542903220142080,
37 7711082599397206192,
38 8303354903384568230,
39 5874150271971943936,
40 9717849827920685054,
41 95829799234282493,
42 ];
43 const ATE_IS_LOOP_COUNT_NEG: bool = true;
44 const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger768 =
45 BigInteger768([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
46 const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = true;
47 const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInteger768([
48 8824542903220142079,
49 7711082599397206192,
50 8303354903384568230,
51 5874150271971943936,
52 9717849827920685054,
53 95829799234282493,
54 0,
55 0,
56 0,
57 0,
58 0,
59 0,
60 ]);
61 type Fp = Fq;
62 type Fr = Fr;
63 type Fp2Params = Fq2Parameters;
64 type Fp4Params = Fq4Parameters;
65 type G1Parameters = self::g1::Parameters;
66 type G2Parameters = self::g2::Parameters;
67}
68
69// 26
70pub const G1_COEFF_A_NON_RESIDUE: Fq = field_new!(Fq, "26");
71
72pub const FQ_ZERO: Fq = field_new!(Fq, "0");
73pub const FQ_ONE: Fq = field_new!(Fq, "1");
74pub const FR_ZERO: Fr = field_new!(Fr, "0");
75pub const FR_ONE: Fr = field_new!(Fr, "1");