Browse Source

Update `ed_on_bls12_381`

fq2_neg_nonresidue
Pratyush Mishra 4 years ago
parent
commit
128f0f5b65
1 changed files with 13 additions and 48 deletions
  1. +13
    -48
      ed_on_bls12_381/src/curves/mod.rs

+ 13
- 48
ed_on_bls12_381/src/curves/mod.rs

@ -3,7 +3,7 @@ use ark_ec::{
models::{ModelParameters, MontgomeryModelParameters, TEModelParameters},
twisted_edwards_extended::{GroupAffine, GroupProjective},
};
use ark_ff::{biginteger::BigInteger256, field_new};
use ark_ff::field_new;
#[cfg(test)]
mod tests;
@ -11,21 +11,6 @@ mod tests;
pub type EdwardsAffine = GroupAffine<EdwardsParameters>;
pub type EdwardsProjective = GroupProjective<EdwardsParameters>;
#[rustfmt::skip]
const GENERATOR_X: Fq = field_new!(Fq, BigInteger256([
14080349899812819339,
4104857150246327429,
8293216003873356624,
7400363483732984990,
]));
#[rustfmt::skip]
const GENERATOR_Y: Fq = field_new!(Fq, BigInteger256([
13388310974700241893,
7654361511478576605,
8037907163910805792,
5188938133920569885,
]));
/// `JubJub` is a twisted Edwards curve. These curves have equations of the
/// form: ax² + y² = 1 - dx²y².
/// over some base finite field Fq.
@ -58,21 +43,11 @@ impl ModelParameters for EdwardsParameters {
impl TEModelParameters for EdwardsParameters {
/// COEFF_A = -1
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, BigInteger256([
18446744060824649731,
18102478225614246908,
11073656695919314959,
6613806504683796440,
]));
const COEFF_A: Fq = field_new!(Fq, "-1");
/// COEFF_D = (10240/10241) mod q
#[rustfmt::skip]
const COEFF_D: Fq = field_new!(Fq, BigInteger256([
3049539848285517488,
18189135023605205683,
8793554888777148625,
6339087681201251886,
]));
const COEFF_D: Fq = field_new!(Fq, "19257038036680949359750312669786877991949435402254120286184196891950884077233");
/// COFACTOR = 8
const COFACTOR: &'static [u64] = &[8];
@ -80,12 +55,7 @@ impl TEModelParameters for EdwardsParameters {
/// COFACTOR^(-1) mod r =
/// 819310549611346726241370945440405716213240158234039660170669895299022906775
#[rustfmt::skip]
const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([
6832491983681988242,
12911748493335322362,
17523939349049608702,
217463794347581613,
]));
const COFACTOR_INV: Fr = field_new!(Fr, "819310549611346726241370945440405716213240158234039660170669895299022906775");
/// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);
@ -100,22 +70,17 @@ impl TEModelParameters for EdwardsParameters {
}
impl MontgomeryModelParameters for EdwardsParameters {
/// COEFF_A = 0xA002
/// COEFF_A = 40962
#[rustfmt::skip]
const COEFF_A: Fq = field_new!(Fq, BigInteger256([
388496971701930u64,
6855257088226130262u64,
553476580979119549u64,
6516741293351590684u64,
]));
/// COEFF_B = 0x73EDA753299D7D483339D80809A1D80553BDA402FFFE5BFEFFFFFFFEFFFF5FFD
const COEFF_A: Fq = field_new!(Fq, "40962");
/// COEFF_B = -40964
#[rustfmt::skip]
const COEFF_B: Fq = field_new!(Fq, BigInteger256([
18446355550968045916u64,
10902955289292811939u64,
3147092737149958754u64,
6710871716016002197u64,
]));
const COEFF_B: Fq = field_new!(Fq, "-40964");
type TEModelParameters = EdwardsParameters;
}
#[rustfmt::skip]
const GENERATOR_X: Fq = field_new!(Fq, "8076246640662884909881801758704306714034609987455869804520522091855516602923");
#[rustfmt::skip]
const GENERATOR_Y: Fq = field_new!(Fq, "13262374693698910701929044844600465831413122818447359594527400194675274060458");

Loading…
Cancel
Save