|
|
@ -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;
|
|
|
@ -22,21 +22,11 @@ impl ModelParameters for EdwardsParameters { |
|
|
|
impl TEModelParameters for EdwardsParameters {
|
|
|
|
/// COEFF_A = -1
|
|
|
|
#[rustfmt::skip]
|
|
|
|
const COEFF_A: Fq = field_new!(Fq, BigInteger256([
|
|
|
|
0x8cf500000000000e,
|
|
|
|
0xe75281ef6000000e,
|
|
|
|
0x49dc37a90b0ba012,
|
|
|
|
0x55f8b2c6e710ab9,
|
|
|
|
]));
|
|
|
|
const COEFF_A: Fq = field_new!(Fq, "-1");
|
|
|
|
|
|
|
|
/// COEFF_D = 3021
|
|
|
|
#[rustfmt::skip]
|
|
|
|
const COEFF_D: Fq = field_new!(Fq, BigInteger256([
|
|
|
|
0xd047ffffffff5e30,
|
|
|
|
0xf0a91026ffff57d2,
|
|
|
|
0x9013f560d102582,
|
|
|
|
0x9fd242ca7be5700,
|
|
|
|
]));
|
|
|
|
const COEFF_D: Fq = field_new!(Fq, "3021");
|
|
|
|
|
|
|
|
/// COFACTOR = 4
|
|
|
|
const COFACTOR: &'static [u64] = &[4];
|
|
|
@ -44,12 +34,7 @@ impl TEModelParameters for EdwardsParameters { |
|
|
|
/// COFACTOR_INV =
|
|
|
|
/// 527778859339273151515551558673846658209717731602102048798421311598680340096
|
|
|
|
#[rustfmt::skip]
|
|
|
|
const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([
|
|
|
|
10836190823041854989,
|
|
|
|
14880086764632731920,
|
|
|
|
5023208332782666747,
|
|
|
|
239524813690824359,
|
|
|
|
]));
|
|
|
|
const COFACTOR_INV: Fr = field_new!(Fr, "527778859339273151515551558673846658209717731602102048798421311598680340096");
|
|
|
|
|
|
|
|
/// Generated randomly
|
|
|
|
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) = (GENERATOR_X, GENERATOR_Y);
|
|
|
@ -66,41 +51,23 @@ impl TEModelParameters for EdwardsParameters { |
|
|
|
|
|
|
|
impl MontgomeryModelParameters for EdwardsParameters {
|
|
|
|
/// COEFF_A = 0x8D26E3FADA9010A26949031ECE3971B93952AD84D4753DDEDB748DA37E8F552
|
|
|
|
/// = 3990301581132929505568273333084066329187552697088022219156688740916631500114
|
|
|
|
#[rustfmt::skip]
|
|
|
|
const COEFF_A: Fq = field_new!(Fq, BigInteger256([
|
|
|
|
13800168384327121454u64,
|
|
|
|
6841573379969807446u64,
|
|
|
|
12529593083398462246u64,
|
|
|
|
853978956621483129u64,
|
|
|
|
]));
|
|
|
|
const COEFF_A: Fq = field_new!(Fq, "3990301581132929505568273333084066329187552697088022219156688740916631500114");
|
|
|
|
/// COEFF_B = 0x9D8F71EEC83A44C3A1FBCEC6F5418E5C6154C2682B8AC231C5A3725C8170AAD
|
|
|
|
/// = 4454160168295440918680551605697480202188346638066041608778544715000777738925
|
|
|
|
#[rustfmt::skip]
|
|
|
|
const COEFF_B: Fq = field_new!(Fq, BigInteger256([
|
|
|
|
7239382437352637935u64,
|
|
|
|
14509846070439283655u64,
|
|
|
|
5083066350480839936u64,
|
|
|
|
1265663645916442191u64,
|
|
|
|
]));
|
|
|
|
const COEFF_B: Fq = field_new!(Fq, "4454160168295440918680551605697480202188346638066041608778544715000777738925");
|
|
|
|
|
|
|
|
type TEModelParameters = EdwardsParameters;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// GENERATOR_X =
|
|
|
|
/// 7810607721416582242904415504650443951498042435501746664987470571546413371306
|
|
|
|
/// 4497879464030519973909970603271755437257548612157028181994697785683032656389,
|
|
|
|
#[rustfmt::skip]
|
|
|
|
const GENERATOR_X: Fq = field_new!(Fq, BigInteger256([
|
|
|
|
0x5bbc9878d817221d,
|
|
|
|
0xd2b03489424e720,
|
|
|
|
0x6b66f128c16bb3c9,
|
|
|
|
0xdd3bff78733576d,
|
|
|
|
]));
|
|
|
|
const GENERATOR_X: Fq = field_new!(Fq, "4497879464030519973909970603271755437257548612157028181994697785683032656389");
|
|
|
|
|
|
|
|
/// GENERATOR_Y =
|
|
|
|
/// 1867362672570137759132108893390349941423731440336755218616442213142473202417
|
|
|
|
/// 4357141146396347889246900916607623952598927460421559113092863576544024487809
|
|
|
|
#[rustfmt::skip]
|
|
|
|
const GENERATOR_Y: Fq = field_new!(Fq, BigInteger256([
|
|
|
|
0x471517ae5e5e979e,
|
|
|
|
0xd9c97f6a73a7ff83,
|
|
|
|
0x85a95b45a5494402,
|
|
|
|
0xfad27c9b545b1f0,
|
|
|
|
]));
|
|
|
|
const GENERATOR_Y: Fq = field_new!(Fq, "4357141146396347889246900916607623952598927460421559113092863576544024487809");
|