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::new([
21        0xd201000000010000,
22        0x0,
23        0x0,
24        0x0,
25        0x0,
26        0x0,
27        0x0,
28        0x0,
29        0x0,
30        0x0,
31        0x0,
32        0x0,
33    ]);
34    const X_IS_NEGATIVE: bool = true;
35    // [(-X)+1]/3, since X < 0
36    const X_MINUS_1_DIV_3: BigInteger = BigInt::new([
37        0x460055555555aaab,
38        0x0,
39        0x0,
40        0x0,
41        0x0,
42        0x0,
43        0x0,
44        0x0,
45        0x0,
46        0x0,
47        0x0,
48        0x0,
49    ]);
50    // -[(-X)+1]
51    const ATE_LOOP_COUNT_1: &'static [u64] = &[0xd20100000000ffff];
52    const ATE_LOOP_COUNT_1_IS_NEGATIVE: bool = true;
53    // -[(-X)^3-(-X)^2-(-X)] in 2-NAF
54    const ATE_LOOP_COUNT_2: &'static [i8] = &[
55        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,
56        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,
57        -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,
58        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,
59        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,
60        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,
61        1, 0, 0, 1, 0, 1, 0, 1, 0, -1, 0, 1, 0, 0, 1,
62    ];
63    const ATE_LOOP_COUNT_2_IS_NEGATIVE: bool = true;
64    const TWIST_TYPE: TwistType = TwistType::M;
65    const H_T: i64 = -4;
66    const H_Y: i64 = -6;
67    const T_MOD_R_IS_ZERO: bool = true;
68    type Fp = Fq;
69    type Fp3Config = Fq3Config;
70    type Fp6Config = Fq6Config;
71    type G1Config = g1::Config;
72    type G2Config = g2::Config;
73}
74
75pub type BW6_767 = BW6<Config>;
76
77pub type G1Affine = bw6::G1Affine<Config>;
78pub type G1Projective = bw6::G1Projective<Config>;
79pub type G2Affine = bw6::G2Affine<Config>;
80pub type G2Projective = bw6::G2Projective<Config>;