arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/bw6_767/src/curves/mod.rs
bw6_767/src/curves/mod.rsRaw
 1use ark_ec::{
 2    bw6,
 3    bw6::{BW6Config, TwistType, BW6},
 4};
 5use ark_ff::{biginteger::BigInteger768 as BigInteger, BigInt};
 6
 7use crate::*;
 8
 9pub mod g1;
10pub mod g2;
11
12#[cfg(test)]
13mod tests;
14
15#[derive(PartialEq, Eq)]
16pub struct Config;
17
18impl BW6Config for Config {
19    // X is the same as in bls12_381
20    const X: BigInteger = BigInt!("0xd201000000010000");
21    const X_IS_NEGATIVE: bool = true;
22    // [(-X)+1]/3, since X < 0
23    const X_MINUS_1_DIV_3: BigInteger = BigInt!("0x460055555555aaab");
24    // -[(-X)+1]
25    const ATE_LOOP_COUNT_1: &'static [u64] = &[0xd20100000000ffff];
26    const ATE_LOOP_COUNT_1_IS_NEGATIVE: bool = true;
27    // -[(-X)^3-(-X)^2-(-X)] in 2-NAF
28    const ATE_LOOP_COUNT_2: &'static [i8] = &[
29        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
30        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0,
31        -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1,
32        0, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0,
33        0, 0, 0, -1, 0, 1, 0, -1, 0, 1, 0, 0, 1, 0, -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0,
34        0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 1, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1, 0, 0,
35        1, 0, 0, 1, 0, 1, 0, 1, 0, -1, 0, 1, 0, 0, 1,
36    ];
37    const ATE_LOOP_COUNT_2_IS_NEGATIVE: bool = true;
38    const TWIST_TYPE: TwistType = TwistType::M;
39    const H_T: i64 = -4;
40    const H_Y: i64 = -6;
41    const T_MOD_R_IS_ZERO: bool = true;
42    type Fp = Fq;
43    type Fp3Config = Fq3Config;
44    type Fp6Config = Fq6Config;
45    type G1Config = g1::Config;
46    type G2Config = g2::Config;
47}
48
49pub type BW6_767 = BW6<Config>;
50
51pub type G1Affine = bw6::G1Affine<Config>;
52pub type G1Projective = bw6::G1Projective<Config>;
53pub type G2Affine = bw6::G2Affine<Config>;
54pub type G2Projective = bw6::G2Projective<Config>;