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::{
  6    biginteger::{BigInteger384, BigInteger832},
  7    field_new,
  8};
  9
 10use crate::{Fq, Fr};
 11
 12pub type G1Affine = GroupAffine<Parameters>;
 13pub type G1Projective = GroupProjective<Parameters>;
 14
 15#[derive(Clone, Default, PartialEq, Eq)]
 16pub struct Parameters;
 17
 18impl ModelParameters for Parameters {
 19    type BaseField = Fq;
 20    type ScalarField = Fr;
 21}
 22
 23impl SWModelParameters for Parameters {
 24    /// COEFF_A = 5
 25    #[rustfmt::skip]
 26    const COEFF_A: Fq = field_new!(Fq, BigInteger832([
 27        0x781c76643018bd7a,
 28        0x64f3a5a4f1d1ad48,
 29        0xd2f8a1eb4f72692d,
 30        0xc35eb123c6ed72ca,
 31        0xb58d6bcfd32de058,
 32        0x841eab13b02a492c,
 33        0x4b70dc5a54c487e7,
 34        0x2f231a8808a74c59,
 35        0x5e2915154d70b050,
 36        0x8a40fa16f37a6b37,
 37        0xd01980093a72c54b,
 38        0xef6845c25398004c,
 39        0x48,
 40    ]));
 41
 42    /// COEFF_B = 17764315118651679038286329069295091506801468118146712649886336045535808055361274148466772191243305528312843236347777260247138934336850548243151534538734724191505953341403463040067571652261229308333392040104884438208594329793895206056414
 43    #[rustfmt::skip]
 44    const COEFF_B: Fq = field_new!(Fq, BigInteger832([
 45        0xec5bd271ad37429,
 46        0x9db8ac843ecca28a,
 47        0x94f29bcb7e01bc74,
 48        0x1b0bebb77bb5af0,
 49        0x75b8cef4aa27ee17,
 50        0xb5767ae80812cf6b,
 51        0x592fa41e377a0d8c,
 52        0xb6c6deedbb52df3e,
 53        0xcb1343e488737fd4,
 54        0x878020734d05b5a9,
 55        0x2f51354eddfa069a,
 56        0x498e2ecdc545243e,
 57        0x2c2,
 58    ]));
 59
 60    /// COFACTOR =
 61    /// 86482221941698704497288378992285180119495364068003923046442785886272123124361700722982503222189455144364945735564951561028
 62    #[rustfmt::skip]
 63    const COFACTOR: &'static [u64] = &[
 64        0x5657b9b57b942344,
 65        0x84f9a65f3bd54eaf,
 66        0x5ea4214e35cd127,
 67        0xe3cbcbc14ec1501d,
 68        0xf196cb845a3092ab,
 69        0x7e14627ad0e19017,
 70        0x217db4,
 71    ];
 72
 73    /// COFACTOR^(-1) mod r =
 74    /// 163276846538158998893990986356139314746223949404500031940624325017036397274793417940375498603127780919653358641788
 75    #[rustfmt::skip]
 76    const COFACTOR_INV: Fr = field_new!(Fr, BigInteger384([
 77        4179837108212676264,
 78        15545810469293120493,
 79        13202863094424182470,
 80        9506285060796071546,
 81        9248558385029790142,
 82        87030208545296111,
 83    ]));
 84
 85    /// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
 86    const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
 87        (G1_GENERATOR_X, G1_GENERATOR_Y);
 88}
 89
 90/// G1_GENERATOR_X =
 91/// 5511163824921585887915590525772884263960974614921003940645351443740084257508990841338974915037175497689287870585840954231884082785026301437744745393958283053278991955159266640440849940136976927372133743626748847559939620888818486853646
 92#[rustfmt::skip]
 93pub const G1_GENERATOR_X: Fq = field_new!(Fq, BigInteger832([
 94    0x5901480e5bc22290,
 95    0x20024afcdb9bd3a9,
 96    0x12dc18ff416e8138,
 97    0x28c69aa0ea223e18,
 98    0xafb1524a1eb7efe6,
 99    0x3d5c34edc3764ca2,
100    0x736c2230c8466ce9,
101    0xacfaa04e051014f1,
102    0x5d5ff82f00ff2964,
103    0x64c13ba270a26eaf,
104    0x50e9864b56ab172e,
105    0xd8370826a322499e,
106    0x00000000000006f1,
107]));
108
109/// G1_GENERATOR_Y =
110/// 7913123550914612057135582061699117755797758113868200992327595317370485234417808273674357776714522052694559358668442301647906991623400754234679697332299689255516547752391831738454121261248793568285885897998257357202903170202349380518443
111#[rustfmt::skip]
112pub const G1_GENERATOR_Y: Fq = field_new!(Fq, BigInteger832([
113    0x8af8b64b402e1953,
114    0xd1bbceb3a258ea51,
115    0xdca9efa3140aaa0d,
116    0x807a610058ddedb2,
117    0xeb898562fe88076c,
118    0x0e4342ca56dd8ce2,
119    0x4f5528d29f1bde9a,
120    0xf18b0c6c19feb372,
121    0x94503ac2fac9199c,
122    0xffc86a8aff08ea34,
123    0xf7b1295214735d8c,
124    0x44eda9e0f55edd10,
125    0x0000000000000ef3,
126]));