arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/cp6_782/src/curves/g1.rs
cp6_782/src/curves/g1.rsRaw
 1use ark_ec::{
 2    models::{ModelParameters, SWModelParameters},
 3    short_weierstrass_jacobian::{GroupAffine, GroupProjective},
 4};
 5use ark_ff::field_new;
 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
20impl SWModelParameters for Parameters {
21    /// COEFF_A = 5
22    #[rustfmt::skip]
23    const COEFF_A: Fq = field_new!(Fq, "5");
24
25    /// COEFF_B = 17764315118651679038286329069295091506801468118146712649886336045535808055361274148466772191243305528312843236347777260247138934336850548243151534538734724191505953341403463040067571652261229308333392040104884438208594329793895206056414
26    #[rustfmt::skip]
27    const COEFF_B: Fq = field_new!(Fq, "17764315118651679038286329069295091506801468118146712649886336045535808055361274148466772191243305528312843236347777260247138934336850548243151534538734724191505953341403463040067571652261229308333392040104884438208594329793895206056414");
28
29    /// COFACTOR =
30    /// 86482221941698704497288378992285180119495364068003923046442785886272123124361700722982503222189455144364945735564951561028
31    #[rustfmt::skip]
32    const COFACTOR: &'static [u64] = &[
33        0x5657b9b57b942344,
34        0x84f9a65f3bd54eaf,
35        0x5ea4214e35cd127,
36        0xe3cbcbc14ec1501d,
37        0xf196cb845a3092ab,
38        0x7e14627ad0e19017,
39        0x217db4,
40    ];
41
42    /// COFACTOR^(-1) mod r =
43    /// 163276846538158998893990986356139314746223949404500031940624325017036397274793417940375498603127780919653358641788
44    #[rustfmt::skip]
45    const COFACTOR_INV: Fr = field_new!(Fr, "163276846538158998893990986356139314746223949404500031940624325017036397274793417940375498603127780919653358641788");
46
47    /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
48    const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
49        (G1_GENERATOR_X, G1_GENERATOR_Y);
50}
51
52/// G1_GENERATOR_X =
53/// 5511163824921585887915590525772884263960974614921003940645351443740084257508990841338974915037175497689287870585840954231884082785026301437744745393958283053278991955159266640440849940136976927372133743626748847559939620888818486853646
54#[rustfmt::skip]
55pub const G1_GENERATOR_X: Fq = field_new!(Fq, "5511163824921585887915590525772884263960974614921003940645351443740084257508990841338974915037175497689287870585840954231884082785026301437744745393958283053278991955159266640440849940136976927372133743626748847559939620888818486853646");
56
57/// G1_GENERATOR_Y =
58/// 7913123550914612057135582061699117755797758113868200992327595317370485234417808273674357776714522052694559358668442301647906991623400754234679697332299689255516547752391831738454121261248793568285885897998257357202903170202349380518443
59#[rustfmt::skip]
60pub const G1_GENERATOR_Y: Fq = field_new!(Fq, "7913123550914612057135582061699117755797758113868200992327595317370485234417808273674357776714522052694559358668442301647906991623400754234679697332299689255516547752391831738454121261248793568285885897998257357202903170202349380518443");