ark-curves-cherry-picked/bw6_761/src/curves/g2.rs
bw6_761/src/curves/g2.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 G2Affine = GroupAffine<Parameters>;
9pub type G2Projective = 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 /// COFACTOR =
19 /// 26642435879335816683987677701488073867751118270052650655942102502312977592501693353047140953112195348280268661194869
20 #[rustfmt::skip]
21 const COFACTOR: &'static [u64] = &[
22 0x3de5800000000075,
23 0x832ba4061000003b,
24 0xc61c554757551c0c,
25 0xc856a0853c9db94c,
26 0x2c77d5ac34cb12ef,
27 0xad1972339049ce76,
28 ];
29
30 /// COFACTOR^(-1) mod r =
31 /// 214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124
32 #[rustfmt::skip]
33 const COFACTOR_INV: Fr = field_new!(Fr, "214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124");
34}
35
36impl SWModelParameters for Parameters {
37 /// COEFF_A = 0
38 #[rustfmt::skip]
39
40 const COEFF_A: Fq = field_new!(Fq, "0");
41
42 /// COEFF_B = 4
43 #[rustfmt::skip]
44 const COEFF_B: Fq = field_new!(Fq, "4");
45
46 /// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
47 const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
48 (G2_GENERATOR_X, G2_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/// G2_GENERATOR_X =
57/// 6445332910596979336035888152774071626898886139774101364933948236926875073754470830732273879639675437155036544153105017729592600560631678554299562762294743927912429096636156401171909259073181112518725201388196280039960074422214428
58#[rustfmt::skip]
59pub const G2_GENERATOR_X: Fq = field_new!(Fq, "6445332910596979336035888152774071626898886139774101364933948236926875073754470830732273879639675437155036544153105017729592600560631678554299562762294743927912429096636156401171909259073181112518725201388196280039960074422214428");
60
61/// G2_GENERATOR_Y =
62/// 562923658089539719386922163444547387757586534741080263946953401595155211934630598999300396317104182598044793758153214972605680357108252243146746187917218885078195819486220416605630144001533548163105316661692978285266378674355041
63#[rustfmt::skip]
64pub const G2_GENERATOR_Y: Fq = field_new!(Fq, "562923658089539719386922163444547387757586534741080263946953401595155211934630598999300396317104182598044793758153214972605680357108252243146746187917218885078195819486220416605630144001533548163105316661692978285266378674355041");