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