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::{
7 biginteger::{BigInteger384, BigInteger768},
8 field_new,
9};
10
11pub type G1Affine = GroupAffine<Parameters>;
12pub type G1Projective = GroupProjective<Parameters>;
13
14#[derive(Clone, Default, PartialEq, Eq)]
15pub struct Parameters;
16
17impl ModelParameters for Parameters {
18 type BaseField = Fq;
19 type ScalarField = Fr;
20}
21
22impl SWModelParameters for Parameters {
23 /// COEFF_A = 0
24 #[rustfmt::skip]
25
26 const COEFF_A: Fq = field_new!(Fq, BigInteger768([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
27
28 /// COEFF_B = -1
29 #[rustfmt::skip]
30 const COEFF_B: Fq = field_new!(Fq, BigInteger768([
31 0xf29a000000007ab6,
32 0x8c391832e000739b,
33 0x77738a6b6870f959,
34 0xbe36179047832b03,
35 0x84f3089e56574722,
36 0xc5a3614ac0b1d984,
37 0x5c81153f4906e9fe,
38 0x4d28be3a9f55c815,
39 0xd72c1d6f77d5f5c5,
40 0x73a18e069ac04458,
41 0xf9dfaa846595555f,
42 0xd0f0a60a5be58c,
43 ]));
44
45 /// COFACTOR =
46 /// 26642435879335816683987677701488073867751118270052650655942102502312977592501693353047140953112195348280268661194876
47 #[rustfmt::skip]
48 const COFACTOR: &'static [u64] = &[
49 0x3de580000000007c,
50 0x832ba4061000003b,
51 0xc61c554757551c0c,
52 0xc856a0853c9db94c,
53 0x2c77d5ac34cb12ef,
54 0xad1972339049ce76,
55 ];
56
57 /// COFACTOR^(-1) mod r =
58 /// 91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804
59 #[rustfmt::skip]
60 const COFACTOR_INV: Fr = field_new!(Fr, BigInteger384([
61 489703175600125849,
62 3883341943836920852,
63 1678256062427438196,
64 5848789333018172718,
65 7127967896440782320,
66 71512347676739162,
67 ]));
68
69 /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
70 const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
71 (G1_GENERATOR_X, G1_GENERATOR_Y);
72 #[inline(always)]
73 fn mul_by_a(_elem: &Self::BaseField) -> Self::BaseField {
74 use ark_ff::Zero;
75 Self::BaseField::zero()
76 }
77}
78
79/// G1_GENERATOR_X =
80/// 6238772257594679368032145693622812838779005809760824733138787810501188623461307351759238099287535516224314149266511977132140828635950940021790489507611754366317801811090811367945064510304504157188661901055903167026722666149426237
81#[rustfmt::skip]
82pub const G1_GENERATOR_X: Fq = field_new!(Fq, BigInteger768([
83 0xd6e42d7614c2d770,
84 0x4bb886eddbc3fc21,
85 0x64648b044098b4d2,
86 0x1a585c895a422985,
87 0xf1a9ac17cf8685c9,
88 0x352785830727aea5,
89 0xddf8cb12306266fe,
90 0x6913b4bfbc9e949a,
91 0x3a4b78d67ba5f6ab,
92 0x0f481c06a8d02a04,
93 0x91d4e7365c43edac,
94 0xf4d17cd48beca5,
95]));
96
97/// G1_GENERATOR_Y =
98/// 2101735126520897423911504562215834951148127555913367997162789335052900271653517958562461315794228241561913734371411178226936527683203879553093934185950470971848972085321797958124416462268292467002957525517188485984766314758624099
99#[rustfmt::skip]
100pub const G1_GENERATOR_Y: Fq = field_new!(Fq, BigInteger768([
101 0x97e805c4bd16411f,
102 0x870d844e1ee6dd08,
103 0x1eba7a37cb9eab4d,
104 0xd544c4df10b9889a,
105 0x8fe37f21a33897be,
106 0xe9bf99a43a0885d2,
107 0xd7ee0c9e273de139,
108 0xaa6a9ec7a38dd791,
109 0x8f95d3fcf765da8e,
110 0x42326e7db7357c99,
111 0xe217e407e218695f,
112 0x9d1eb23b7cf684,
113]));