arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/bw6_761/src/curves/g1.rs
bw6_761/src/curves/g1.rsRaw
 1use crate::{Fq, Fr};
 2use ark_ec::{
 3    models::{ModelParameters, SWModelParameters},
 4    short_weierstrass_jacobian::{GroupAffine, GroupProjective},
 5};
 6use ark_ff::field_new;
 7
 8pub type G1Affine = GroupAffine<Parameters>;
 9pub type G1Projective = GroupProjective<Parameters>;
10
11#[derive(Clone, Default, PartialEq, Eq)]
12pub struct Parameters;
13
14impl ModelParameters for Parameters {
15    type BaseField = Fq;
16    type ScalarField = Fr;
17}
18
19impl SWModelParameters for Parameters {
20    /// COEFF_A = 0
21    #[rustfmt::skip]
22
23    const COEFF_A: Fq = field_new!(Fq, "0");
24
25    /// COEFF_B = -1
26    #[rustfmt::skip]
27    const COEFF_B: Fq = field_new!(Fq, "-1");
28
29    /// COFACTOR =
30    /// 26642435879335816683987677701488073867751118270052650655942102502312977592501693353047140953112195348280268661194876
31    #[rustfmt::skip]
32    const COFACTOR: &'static [u64] = &[
33        0x3de580000000007c,
34        0x832ba4061000003b,
35        0xc61c554757551c0c,
36        0xc856a0853c9db94c,
37        0x2c77d5ac34cb12ef,
38        0xad1972339049ce76,
39    ];
40
41    /// COFACTOR^(-1) mod r =
42    /// 91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804
43    #[rustfmt::skip]
44    const COFACTOR_INV: Fr = field_new!(Fr, "91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804");
45
46    /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
47    const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
48        (G1_GENERATOR_X, G1_GENERATOR_Y);
49    #[inline(always)]
50    fn mul_by_a(_elem: &Self::BaseField) -> Self::BaseField {
51        use ark_ff::Zero;
52        Self::BaseField::zero()
53    }
54}
55
56/// G1_GENERATOR_X =
57/// 6238772257594679368032145693622812838779005809760824733138787810501188623461307351759238099287535516224314149266511977132140828635950940021790489507611754366317801811090811367945064510304504157188661901055903167026722666149426237
58#[rustfmt::skip]
59pub const G1_GENERATOR_X: Fq = field_new!(Fq, "6238772257594679368032145693622812838779005809760824733138787810501188623461307351759238099287535516224314149266511977132140828635950940021790489507611754366317801811090811367945064510304504157188661901055903167026722666149426237");
60
61/// G1_GENERATOR_Y =
62/// 2101735126520897423911504562215834951148127555913367997162789335052900271653517958562461315794228241561913734371411178226936527683203879553093934185950470971848972085321797958124416462268292467002957525517188485984766314758624099
63#[rustfmt::skip]
64pub const G1_GENERATOR_Y: Fq = field_new!(Fq, "2101735126520897423911504562215834951148127555913367997162789335052900271653517958562461315794228241561913734371411178226936527683203879553093934185950470971848972085321797958124416462268292467002957525517188485984766314758624099");