Browse Source

`BigInt` fixes corresponding to algebra#372

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
update-to-latest-arkworks
Marcin 2 years ago
committed by GitHub
parent
commit
6a5cf1d84a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 315 additions and 307 deletions
  1. +13
    -10
      bls12_377/src/fields/fq.rs
  2. +12
    -10
      bls12_377/src/fields/fr.rs
  3. +5
    -8
      bls12_377/src/fields/tests.rs
  4. +2
    -2
      bls12_381/src/curves/g2.rs
  5. +9
    -9
      bls12_381/src/fields/fq.rs
  6. +9
    -9
      bls12_381/src/fields/fr.rs
  7. +79
    -82
      bls12_381/src/fields/tests.rs
  8. +13
    -9
      bn254/src/fields/fq.rs
  9. +12
    -9
      bn254/src/fields/fr.rs
  10. +5
    -5
      bn254/src/fields/tests.rs
  11. +2
    -2
      bw6_761/src/curves/mod.rs
  12. +9
    -9
      bw6_761/src/fields/fq.rs
  13. +3
    -3
      cp6_782/src/curves/mod.rs
  14. +9
    -9
      cp6_782/src/fields/fq.rs
  15. +8
    -8
      ed_on_bls12_377/src/fields/fr.rs
  16. +8
    -8
      ed_on_bls12_381/src/fields/fr.rs
  17. +1
    -1
      ed_on_bls12_381_bandersnatch/Cargo.toml
  18. +9
    -9
      ed_on_bls12_381_bandersnatch/src/fields/fr.rs
  19. +9
    -9
      ed_on_bn254/src/fields/fr.rs
  20. +9
    -9
      ed_on_cp6_782/src/fields/fr.rs
  21. +9
    -9
      ed_on_mnt4_298/src/fields/fr.rs
  22. +9
    -9
      ed_on_mnt4_753/src/fields/fr.rs
  23. +3
    -3
      mnt4_298/src/curves/mod.rs
  24. +10
    -10
      mnt4_298/src/fields/fq.rs
  25. +9
    -9
      mnt4_298/src/fields/fr.rs
  26. +6
    -3
      mnt4_753/src/curves/mod.rs
  27. +10
    -10
      mnt4_753/src/fields/fq.rs
  28. +9
    -9
      mnt4_753/src/fields/fr.rs
  29. +3
    -3
      mnt6_298/src/curves/mod.rs
  30. +3
    -3
      mnt6_753/src/curves/mod.rs
  31. +9
    -10
      pallas/src/fields/fq.rs
  32. +9
    -9
      pallas/src/fields/fr.rs

+ 13
- 10
bls12_377/src/fields/fq.rs

@ -1,4 +1,7 @@
use ark_ff::{biginteger::BigInteger384 as BigInteger, fields::*};
use ark_ff::{
biginteger::{BigInt, BigInteger384 as BigInteger},
fields::*,
};
pub type Fq = Fp384<FqParameters>;
@ -11,7 +14,7 @@ impl FftParameters for FqParameters {
const TWO_ADICITY: u32 = 46u32;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
2022196864061697551u64,
17419102863309525423u64,
8564289679875062096u64,
@ -23,7 +26,7 @@ impl FftParameters for FqParameters {
impl FpParameters for FqParameters {
/// MODULUS = 258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0x8508c00000000001,
0x170b5d4430000000,
0x1ef3622fba094800,
@ -40,7 +43,7 @@ impl FpParameters for FqParameters {
/// R = 85013442423176922659824578519796707547925331718418265885885478904210582549405549618995257669764901891699128663912
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
202099033278250856u64,
5854854902718660529u64,
11492539364873682930u64,
@ -50,7 +53,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0xb786686c9400cd22,
0x329fcaab00431b1,
0x22a5f11162d6b46d,
@ -65,7 +68,7 @@ impl FpParameters for FqParameters {
/// Encoded in Montgomery form, so the value here is
/// (-5 * R) % q = 92261639910053574722182574790803529333160366917737991650341130812388023949653897454961487930322210790384999596794
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0xfc0b8000000002fa,
0x97d39cf6e000018b,
0x2072420fbfa05044,
@ -75,7 +78,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x4284600000000000,
0xb85aea218000000,
0x8f79b117dd04a400,
@ -90,7 +93,7 @@ impl FpParameters for FqParameters {
// T = (MODULUS - 1) // 2^S =
// 3675842578061421676390135839012792950148785745837396071634149488243117337281387659330802195819009059
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x7510c00000021423,
0x88bee82520005c2d,
0x67cc03d44e3c7bcd,
@ -102,7 +105,7 @@ impl FpParameters for FqParameters {
// (T - 1) // 2 =
// 1837921289030710838195067919506396475074392872918698035817074744121558668640693829665401097909504529
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xba88600000010a11,
0xc45f741290002e16,
0xb3e601ea271e3de6,
@ -115,4 +118,4 @@ impl FpParameters for FqParameters {
#[allow(dead_code)]
pub const FQ_ONE: Fq = Fq::new(FqParameters::R);
#[allow(dead_code)]
pub const FQ_ZERO: Fq = Fq::new(BigInteger([0, 0, 0, 0, 0, 0]));
pub const FQ_ZERO: Fq = Fq::new(BigInt::new([0, 0, 0, 0, 0, 0]));

+ 12
- 10
bls12_377/src/fields/fr.rs

@ -19,8 +19,10 @@
/// print("Gen: ", into_chunks(g * R % q, 64, 4))
/// print("2-adic gen: ", into_chunks(g2 * R % q, 64, 4))
/// ```
use ark_ff::{biginteger::BigInteger256 as BigInteger, fields::*};
use ark_ff::{
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::*,
};
pub type Fr = Fp256<FrParameters>;
pub struct FrParameters;
@ -32,7 +34,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 47;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
12646347781564978760u64,
6783048705277173164u64,
268534165941069093u64,
@ -42,7 +44,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 8444461749428370424248824938781546531375899335154063827935233455917409239041
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
725501752471715841u64,
6461107452199829505u64,
6968279316240510977u64,
@ -57,7 +59,7 @@ impl FpParameters for FrParameters {
/// R = 6014086494747379908336260804527802945383293308637734276299549080986809532403
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
9015221291577245683u64,
8239323489949974514u64,
1646089257421115374u64,
@ -65,7 +67,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
2726216793283724667u64,
14712177743343147295u64,
12091039717619697043u64,
@ -79,7 +81,7 @@ impl FpParameters for FrParameters {
/// (22 * R) % q =
/// 5642976643016801619665363617888466827793962762719196659561577942948671127251
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
2984901390528151251u64,
10561528701063790279u64,
5476750214495080041u64,
@ -89,7 +91,7 @@ impl FpParameters for FrParameters {
/// (r - 1)/2 =
/// 4222230874714185212124412469390773265687949667577031913967616727958704619520
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x8508c00000000000,
0xacd53b7f68000000,
0x305a268f2e1bd800,
@ -102,7 +104,7 @@ impl FpParameters for FrParameters {
/// t = (r - 1) / 2^s =
/// 60001509534603559531609739528203892656505753216962260608619555
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0xedfda00000021423,
0x9a3cb86f6002b354,
0xcabd34594aacc168,
@ -112,7 +114,7 @@ impl FpParameters for FrParameters {
/// (t - 1) / 2 =
/// 30000754767301779765804869764101946328252876608481130304309777
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x76fed00000010a11,
0x4d1e5c37b00159aa,
0x655e9a2ca55660b4,

+ 5
- 8
bls12_377/src/fields/tests.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::{BigInteger, BigInteger384},
biginteger::{BigInt, BigInteger, BigInteger384},
fields::{
fp6_3over2::Fp6Parameters, FftField, FftParameters, Field, Fp2Parameters, FpParameters,
PrimeField, SquareRootField,
@ -24,10 +24,7 @@ generate_field_serialization_test!(bls12_377; fq2; fq6; fq12;);
#[test]
fn test_fq_repr_from() {
assert_eq!(
BigInteger384::from(100),
BigInteger384([100, 0, 0, 0, 0, 0])
);
assert_eq!(BigInt::from(100u64), BigInt::new([100, 0, 0, 0, 0, 0]));
}
#[test]
@ -44,9 +41,9 @@ fn test_fq_repr_is_odd() {
#[test]
fn test_fq_repr_is_zero() {
assert!(BigInteger384::from(0).is_zero());
assert!(!BigInteger384::from(1).is_zero());
assert!(!BigInteger384([0, 0, 0, 0, 1, 0]).is_zero());
assert!(BigInteger384::from(0u64).is_zero());
assert!(!BigInteger384::from(1u64).is_zero());
assert!(!BigInt::new([0, 0, 0, 0, 1, 0]).is_zero());
}
#[test]

+ 2
- 2
bls12_381/src/curves/g2.rs

@ -6,7 +6,7 @@ use ark_ec::{
short_weierstrass_jacobian::GroupAffine,
AffineCurve,
};
use ark_ff::{biginteger::BigInteger256, field_new, Field, Zero};
use ark_ff::{field_new, BigInt, Field, Zero};
pub type G2Affine = bls12::G2Affine<crate::Parameters>;
pub type G2Projective = bls12::G2Projective<crate::Parameters>;
@ -60,7 +60,7 @@ impl SWModelParameters for Parameters {
//
// Checks that [p]P = [X]P
let mut x_times_point = point.mul(BigInteger256([crate::Parameters::X[0], 0, 0, 0]));
let mut x_times_point = point.mul(BigInt::new([crate::Parameters::X[0], 0, 0, 0]));
if crate::Parameters::X_IS_NEGATIVE {
x_times_point = -x_times_point;
}

+ 9
- 9
bls12_381/src/fields/fq.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger384 as BigInteger,
biginteger::{BigInt, BigInteger384 as BigInteger},
field_new,
fields::{FftParameters, Fp384, Fp384Parameters, FpParameters},
};
@ -15,7 +15,7 @@ impl FftParameters for FqParameters {
const TWO_ADICITY: u32 = 1;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0x43f5fffffffcaaae,
0x32b7fff2ed47fffd,
0x7e83a49a2e99d69,
@ -27,7 +27,7 @@ impl FftParameters for FqParameters {
impl FpParameters for FqParameters {
/// MODULUS = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0xb9feffffffffaaab,
0x1eabfffeb153ffff,
0x6730d2a0f6b0f624,
@ -44,7 +44,7 @@ impl FpParameters for FqParameters {
/// R = 3380320199399472671518931668520476396067793891014375699959770179129436917079669831430077592723774664465579537268733
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x760900000002fffd,
0xebf4000bc40c0002,
0x5f48985753c758ba,
@ -54,7 +54,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0xf4df1f341c341746,
0xa76e6a609d104f1,
0x8de5476c4c95b6d5,
@ -69,7 +69,7 @@ impl FpParameters for FqParameters {
/// Encoded in Montgomery form, so the value is
/// 2 * R % q = 2758230843577277949620073511305048635578704962089743514587482222134842183668501798417467556318533664893264801977679
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0x321300000006554f,
0xb93c0018d6c40005,
0x57605e0db0ddbb51,
@ -79,7 +79,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xdcff7fffffffd555,
0xf55ffff58a9ffff,
0xb39869507b587b12,
@ -91,7 +91,7 @@ impl FpParameters for FqParameters {
/// T and T_MINUS_ONE_DIV_TWO, where MODULUS - 1 = 2^S * T
/// For T coprime to 2
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0xdcff7fffffffd555,
0xf55ffff58a9ffff,
0xb39869507b587b12,
@ -101,7 +101,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xee7fbfffffffeaaa,
0x7aaffffac54ffff,
0xd9cc34a83dac3d89,

+ 9
- 9
bls12_381/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::{FftParameters, Fp256, Fp256Parameters, FpParameters},
};
@ -14,7 +14,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 32;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0xb9b58d8c5f0e466a,
0x5b1b4c801819d7ec,
0xaf53ae352a31e64,
@ -24,7 +24,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 52435875175126190479447740508185965837690552500527637822603658699938581184513
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0xffffffff00000001,
0x53bda402fffe5bfe,
0x3339d80809a1d805,
@ -39,7 +39,7 @@ impl FpParameters for FrParameters {
/// R = 10920338887063814464675503992315976177888879664585288394250266608035967270910
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x1fffffffe,
0x5884b7fa00034802,
0x998c4fefecbc4ff5,
@ -47,7 +47,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0xc999e990f3f29c6d,
0x2b6cedcb87925c23,
0x5d314967254398f,
@ -60,7 +60,7 @@ impl FpParameters for FrParameters {
/// Encoded in Montgomery form, so the value here is
/// 7 * R % q = 24006497034320510773280787438025867407531605151569380937148207556313189711857
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0xefffffff1,
0x17e363d300189c0f,
0xff9c57876f8457b0,
@ -68,7 +68,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x7fffffff80000000,
0xa9ded2017fff2dff,
0x199cec0404d0ec02,
@ -81,7 +81,7 @@ impl FpParameters for FrParameters {
// T = (MODULUS - 1) / 2^S =
// 12208678567578594777604504606729831043093128246378069236549469339647
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0xfffe5bfeffffffff,
0x9a1d80553bda402,
0x299d7d483339d808,
@ -91,7 +91,7 @@ impl FpParameters for FrParameters {
// (T - 1) / 2 =
// 6104339283789297388802252303364915521546564123189034618274734669823
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x7fff2dff7fffffff,
0x4d0ec02a9ded201,
0x94cebea4199cec04,

+ 79
- 82
bls12_381/src/fields/tests.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::{BigInteger, BigInteger384},
biginteger::{BigInt, BigInteger, BigInteger384},
fields::{
FftField, FftParameters, Field, Fp12Parameters, Fp2Parameters, Fp6Parameters, FpParameters,
SquareRootField,
@ -20,7 +20,7 @@ generate_field_test!(bls12_381; fq2; fq6; fq12;);
#[test]
fn test_negative_one() {
let neg_one = Fq::new(BigInteger384([
let neg_one = Fq::new(BigInt::new([
0x43f5fffffffcaaae,
0x32b7fff2ed47fffd,
0x7e83a49a2e99d69,
@ -751,17 +751,14 @@ fn test_neg_one() {
0x40ab3263eff0206,
];
println!("{:?}", thing);
let negative_one = Fq::new(BigInteger384(thing));
let negative_one = Fq::new(BigInt::new(thing));
assert_eq!(negative_one, o);
}
#[test]
fn test_fq_repr_from() {
assert_eq!(
BigInteger384::from(100),
BigInteger384([100, 0, 0, 0, 0, 0])
);
assert_eq!(BigInt::from(100u64), BigInt::new([100, 0, 0, 0, 0, 0]));
}
#[test]
@ -778,14 +775,14 @@ fn test_fq_repr_is_odd() {
#[test]
fn test_fq_repr_is_zero() {
assert!(BigInteger384::from(0).is_zero());
assert!(!BigInteger384::from(1).is_zero());
assert!(!BigInteger384([0, 0, 0, 0, 1, 0]).is_zero());
assert!(BigInteger384::from(0u64).is_zero());
assert!(!BigInteger384::from(1u64).is_zero());
assert!(!BigInt::new([0, 0, 0, 0, 1, 0]).is_zero());
}
#[test]
fn test_fq_repr_div2() {
let mut a = BigInteger384([
let mut a = BigInt::new([
0x8b0ad39f8dd7482a,
0x147221c9a7178b69,
0x54764cb08d8a6aa0,
@ -796,7 +793,7 @@ fn test_fq_repr_div2() {
a.div2();
assert_eq!(
a,
BigInteger384([
BigInt::new([
0xc58569cfc6eba415,
0xa3910e4d38bc5b4,
0xaa3b265846c53550,
@ -810,7 +807,7 @@ fn test_fq_repr_div2() {
}
assert_eq!(
a,
BigInteger384([
BigInt::new([
0x6d31615a73f1bae9,
0x54028e443934e2f1,
0x82a8ec99611b14d,
@ -824,23 +821,23 @@ fn test_fq_repr_div2() {
}
assert_eq!(
a,
BigInteger384([0x7288af1f36ee3608, 0x1e8, 0x0, 0x0, 0x0, 0x0])
BigInt::new([0x7288af1f36ee3608, 0x1e8, 0x0, 0x0, 0x0, 0x0])
);
for _ in 0..50 {
a.div2();
}
assert_eq!(a, BigInteger384([0x7a1ca2, 0x0, 0x0, 0x0, 0x0, 0x0]));
assert_eq!(a, BigInt::new([0x7a1ca2, 0x0, 0x0, 0x0, 0x0, 0x0]));
for _ in 0..22 {
a.div2();
}
assert_eq!(a, BigInteger384([0x1, 0x0, 0x0, 0x0, 0x0, 0x0]));
assert_eq!(a, BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0, 0x0]));
a.div2();
assert!(a.is_zero());
}
#[test]
fn test_fq_repr_divn() {
let mut a = BigInteger384([
let mut a = BigInt::new([
0xaa5cdd6172847ffd,
0x43242c06aed55287,
0x9ddd5b312f3dd104,
@ -851,7 +848,7 @@ fn test_fq_repr_divn() {
a.divn(0);
assert_eq!(
a,
BigInteger384([
BigInt::new([
0xaa5cdd6172847ffd,
0x43242c06aed55287,
0x9ddd5b312f3dd104,
@ -863,7 +860,7 @@ fn test_fq_repr_divn() {
a.divn(1);
assert_eq!(
a,
BigInteger384([
BigInt::new([
0xd52e6eb0b9423ffe,
0x21921603576aa943,
0xceeead98979ee882,
@ -875,7 +872,7 @@ fn test_fq_repr_divn() {
a.divn(50);
assert_eq!(
a,
BigInteger384([
BigInt::new([
0x8580d5daaa50f54b,
0xab6625e7ba208864,
0x83fa9008d6fcf3bb,
@ -887,7 +884,7 @@ fn test_fq_repr_divn() {
a.divn(130);
assert_eq!(
a,
BigInteger384([
BigInt::new([
0xa0fea40235bf3cee,
0x4067a038f0582e2a,
0x2f9480d7528a70b0,
@ -899,7 +896,7 @@ fn test_fq_repr_divn() {
a.divn(64);
assert_eq!(
a,
BigInteger384([0x4067a038f0582e2a, 0x2f9480d7528a70b0, 0x91, 0x0, 0x0, 0x0])
BigInt::new([0x4067a038f0582e2a, 0x2f9480d7528a70b0, 0x91, 0x0, 0x0, 0x0])
);
}
@ -907,27 +904,27 @@ fn test_fq_repr_divn() {
fn test_fq_repr_mul2() {
let mut a = BigInteger384::from(23712937547);
a.mul2();
assert_eq!(a, BigInteger384([0xb0acd6c96, 0x0, 0x0, 0x0, 0x0, 0x0]));
assert_eq!(a, BigInt::new([0xb0acd6c96, 0x0, 0x0, 0x0, 0x0, 0x0]));
for _ in 0..60 {
a.mul2();
}
assert_eq!(
a,
BigInteger384([0x6000000000000000, 0xb0acd6c9, 0x0, 0x0, 0x0, 0x0])
BigInt::new([0x6000000000000000, 0xb0acd6c9, 0x0, 0x0, 0x0, 0x0])
);
for _ in 0..300 {
a.mul2();
}
assert_eq!(
a,
BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0xcd6c960000000000])
BigInt::new([0x0, 0x0, 0x0, 0x0, 0x0, 0xcd6c960000000000])
);
for _ in 0..17 {
a.mul2();
}
assert_eq!(
a,
BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x2c00000000000000])
BigInt::new([0x0, 0x0, 0x0, 0x0, 0x0, 0x2c00000000000000])
);
for _ in 0..6 {
a.mul2();
@ -951,7 +948,7 @@ fn test_fq_repr_num_bits() {
fn test_fq_repr_sub_noborrow() {
let mut rng = ark_std::test_rng();
let mut t = BigInteger384([
let mut t = BigInt::new([
0x827a4a08041ebd9,
0x3c239f3dcc8f0d6b,
0x9ab46a912d555364,
@ -959,7 +956,7 @@ fn test_fq_repr_sub_noborrow() {
0xad0eb3948a5c34fd,
0xd56f7b5ab8b5ce8,
]);
t.sub_noborrow(&BigInteger384([
t.sub_noborrow(&BigInt::new([
0xc7867917187ca02b,
0x5d75679d4911ffef,
0x8c5b3e48b1a71c15,
@ -968,7 +965,7 @@ fn test_fq_repr_sub_noborrow() {
0x7c0577a26f59d5,
]));
assert!(
t == BigInteger384([
t == BigInt::new([
0x40a12b8967c54bae,
0xdeae37a0837d0d7b,
0xe592c487bae374e,
@ -1005,7 +1002,7 @@ fn test_fq_repr_sub_noborrow() {
}
// Subtracting q+1 from q should produce -1 (mod 2**384)
let mut qplusone = BigInteger384([
let mut qplusone = BigInt::new([
0xb9feffffffffaaab,
0x1eabfffeb153ffff,
0x6730d2a0f6b0f624,
@ -1013,7 +1010,7 @@ fn test_fq_repr_sub_noborrow() {
0x4b1ba7b6434bacd7,
0x1a0111ea397fe69a,
]);
qplusone.sub_noborrow(&BigInteger384([
qplusone.sub_noborrow(&BigInt::new([
0xb9feffffffffaaac,
0x1eabfffeb153ffff,
0x6730d2a0f6b0f624,
@ -1023,7 +1020,7 @@ fn test_fq_repr_sub_noborrow() {
]));
assert_eq!(
qplusone,
BigInteger384([
BigInt::new([
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
@ -1038,7 +1035,7 @@ fn test_fq_repr_sub_noborrow() {
fn test_fq_repr_add_nocarry() {
let mut rng = ark_std::test_rng();
let mut t = BigInteger384([
let mut t = BigInt::new([
0x827a4a08041ebd9,
0x3c239f3dcc8f0d6b,
0x9ab46a912d555364,
@ -1046,7 +1043,7 @@ fn test_fq_repr_add_nocarry() {
0xad0eb3948a5c34fd,
0xd56f7b5ab8b5ce8,
]);
t.add_nocarry(&BigInteger384([
t.add_nocarry(&BigInt::new([
0xc7867917187ca02b,
0x5d75679d4911ffef,
0x8c5b3e48b1a71c15,
@ -1055,7 +1052,7 @@ fn test_fq_repr_add_nocarry() {
0x7c0577a26f59d5,
]));
assert!(
t == BigInteger384([
t == BigInt::new([
0xcfae1db798be8c04,
0x999906db15a10d5a,
0x270fa8d9defc6f79,
@ -1108,7 +1105,7 @@ fn test_fq_repr_add_nocarry() {
}
// Adding 1 to (2^384 - 1) should produce zero
let mut x = BigInteger384([
let mut x = BigInt::new([
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
@ -1189,7 +1186,7 @@ fn test_fq_legendre() {
Fq::from(BigInteger384::from(4)).legendre()
);
let e = BigInteger384([
let e = BigInt::new([
0x52a112f249778642,
0xd0bedb989b7991f,
0xdad3b6681aa63c05,
@ -1198,7 +1195,7 @@ fn test_fq_legendre() {
0x1022c2fd122889e4,
]);
assert_eq!(QuadraticNonResidue, Fq::from(e).legendre());
let e = BigInteger384([
let e = BigInt::new([
0x6dae594e53a96c74,
0x19b16ca9ba64b37b,
0x5c764661a59bfc68,
@ -1251,7 +1248,7 @@ fn test_fq2_squaring() {
}); // -1
let mut a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x9c2c6309bbf8b598,
0x4eef5c946536f602,
0x90e34aab6fb6a6bd,
@ -1259,7 +1256,7 @@ fn test_fq2_squaring() {
0x41b76dcc1c3fbe5e,
0x7080c5fa1d8e042,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x38f473b3c870a4ab,
0x6ad3291177c8c7e5,
0xdac5a4c911a4353e,
@ -1272,7 +1269,7 @@ fn test_fq2_squaring() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0xf262c28c538bcf68,
0xb9f2a66eae1073ba,
0xdc46ab8fad67ae0,
@ -1280,7 +1277,7 @@ fn test_fq2_squaring() {
0x4cf17b5893c3d327,
0x7eac81369c43361,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0xc1579cf58e980cf8,
0xa23eb7e12dd54d98,
0xe75138bce4cec7aa,
@ -1295,7 +1292,7 @@ fn test_fq2_squaring() {
#[test]
fn test_fq2_mul() {
let mut a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x85c9f989e1461f03,
0xa2e33c333449a1d6,
0x41e461154a7354a3,
@ -1303,7 +1300,7 @@ fn test_fq2_mul() {
0x1c202d8ed97afb45,
0x51d3f9253e2516f,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0xa7348a8b511aedcf,
0x143c215d8176b319,
0x4cc48081c09b8903,
@ -1313,7 +1310,7 @@ fn test_fq2_mul() {
])),
);
a.mul_assign(&Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0xe21f9169805f537e,
0xfc87e62e179c285d,
0x27ece175be07a531,
@ -1321,7 +1318,7 @@ fn test_fq2_mul() {
0x6c9110292bfa409,
0x2c93a72eb8af83e,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x4b1c3f936d8992d4,
0x1d2a72916dba4c8a,
0x8871c508658d1e5f,
@ -1333,7 +1330,7 @@ fn test_fq2_mul() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x95b5127e6360c7e4,
0xde29c31a19a6937e,
0xf61a96dacf5a39bc,
@ -1341,7 +1338,7 @@ fn test_fq2_mul() {
0x5310a202d92f9963,
0x1751afbe166e5399,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x84af0e1bd630117a,
0x6c63cd4da2c2aa7,
0x5ba6e5430e883d40,
@ -1358,7 +1355,7 @@ fn test_fq2_inverse() {
assert!(Fq2::zero().inverse().is_none());
let a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x85c9f989e1461f03,
0xa2e33c333449a1d6,
0x41e461154a7354a3,
@ -1366,7 +1363,7 @@ fn test_fq2_inverse() {
0x1c202d8ed97afb45,
0x51d3f9253e2516f,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0xa7348a8b511aedcf,
0x143c215d8176b319,
0x4cc48081c09b8903,
@ -1379,7 +1376,7 @@ fn test_fq2_inverse() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x70300f9bcb9e594,
0xe5ecda5fdafddbb2,
0x64bef617d2915a8f,
@ -1387,7 +1384,7 @@ fn test_fq2_inverse() {
0xa6c3d8f9586f2636,
0x1351ef01941b70c4,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x8c39fd76a8312cb4,
0x15d7b6b95defbff0,
0x947143f89faedee9,
@ -1402,7 +1399,7 @@ fn test_fq2_inverse() {
#[test]
fn test_fq2_addition() {
let mut a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1410,7 +1407,7 @@ fn test_fq2_addition() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
@ -1420,7 +1417,7 @@ fn test_fq2_addition() {
])),
);
a.add_assign(&Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x619a02d78dc70ef2,
0xb93adfc9119e33e8,
0x4bf0b99a9f0dca12,
@ -1428,7 +1425,7 @@ fn test_fq2_addition() {
0x986a4a62fa82a49d,
0x13ce433fa26027f5,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x66323bf80b58b9b9,
0xa1379b6facf6e596,
0x402aef1fb797e32f,
@ -1440,7 +1437,7 @@ fn test_fq2_addition() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x8e9a7adaf6eb0eb9,
0xcb207e6b3341eaba,
0xd70b0c7b481d23ff,
@ -1448,7 +1445,7 @@ fn test_fq2_addition() {
0x65309427b3d5d090,
0x14c715d5553f01d2,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0xfdb032e7d9079a94,
0x35a2809d15468d83,
0xfe4b23317e0796d5,
@ -1463,7 +1460,7 @@ fn test_fq2_addition() {
#[test]
fn test_fq2_subtraction() {
let mut a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1471,7 +1468,7 @@ fn test_fq2_subtraction() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
@ -1481,7 +1478,7 @@ fn test_fq2_subtraction() {
])),
);
a.sub_assign(&Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x619a02d78dc70ef2,
0xb93adfc9119e33e8,
0x4bf0b99a9f0dca12,
@ -1489,7 +1486,7 @@ fn test_fq2_subtraction() {
0x986a4a62fa82a49d,
0x13ce433fa26027f5,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x66323bf80b58b9b9,
0xa1379b6facf6e596,
0x402aef1fb797e32f,
@ -1501,7 +1498,7 @@ fn test_fq2_subtraction() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x8565752bdb5c9b80,
0x7756bed7c15982e9,
0xa65a6be700b285fe,
@ -1509,7 +1506,7 @@ fn test_fq2_subtraction() {
0x7f77a718021c342d,
0x72ba14049fe9881,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0xeb4abaf7c255d1cd,
0x11df49bc6cacc256,
0xe52617930588c69a,
@ -1524,7 +1521,7 @@ fn test_fq2_subtraction() {
#[test]
fn test_fq2_negation() {
let mut a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1532,7 +1529,7 @@ fn test_fq2_negation() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
@ -1545,7 +1542,7 @@ fn test_fq2_negation() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x8cfe87fc96dbaae4,
0xcc6615c8fb0492d,
0xdc167fc04da19c37,
@ -1553,7 +1550,7 @@ fn test_fq2_negation() {
0x7e555df189f880e3,
0x19083f5486a10cbd,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x228109103250c9d0,
0x8a411ad149045812,
0xa9109e8f3041427e,
@ -1568,7 +1565,7 @@ fn test_fq2_negation() {
#[test]
fn test_fq2_doubling() {
let mut a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1576,7 +1573,7 @@ fn test_fq2_doubling() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
@ -1589,7 +1586,7 @@ fn test_fq2_doubling() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x5a00f006d247ff8e,
0x23cb3d4443476da4,
0x1634a5c1521eb3da,
@ -1597,7 +1594,7 @@ fn test_fq2_doubling() {
0x998c938972a657e7,
0x1f1a52b65bdb3b9,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2efbeddf9b5dc1b6,
0x28d5ca5ad09f4fdb,
0x7c4068238cdf674b,
@ -1612,7 +1609,7 @@ fn test_fq2_doubling() {
#[test]
fn test_fq2_frobenius_map() {
let mut a = Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1620,7 +1617,7 @@ fn test_fq2_frobenius_map() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
@ -1633,7 +1630,7 @@ fn test_fq2_frobenius_map() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1641,7 +1638,7 @@ fn test_fq2_frobenius_map() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
@ -1655,7 +1652,7 @@ fn test_fq2_frobenius_map() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1663,7 +1660,7 @@ fn test_fq2_frobenius_map() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x228109103250c9d0,
0x8a411ad149045812,
0xa9109e8f3041427e,
@ -1677,7 +1674,7 @@ fn test_fq2_frobenius_map() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1685,7 +1682,7 @@ fn test_fq2_frobenius_map() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
@ -1699,7 +1696,7 @@ fn test_fq2_frobenius_map() {
assert_eq!(
a,
Fq2::new(
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
@ -1707,7 +1704,7 @@ fn test_fq2_frobenius_map() {
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])),
Fq::from(BigInteger384([
Fq::from(BigInt::new([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,

+ 13
- 9
bn254/src/fields/fq.rs

@ -1,4 +1,8 @@
use ark_ff::{biginteger::BigInteger256 as BigInteger, field_new, fields::*};
use ark_ff::{
biginteger::{BigInt, BigInteger256 as BigInteger},
field_new,
fields::*,
};
pub type Fq = Fp256<FqParameters>;
@ -11,7 +15,7 @@ impl FftParameters for FqParameters {
const TWO_ADICITY: u32 = 1;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0x68c3488912edefaa,
0x8d087f6872aabf4f,
0x51e1a24709081231,
@ -21,7 +25,7 @@ impl FftParameters for FqParameters {
impl FpParameters for FqParameters {
/// MODULUS = 21888242871839275222246405745257275088696311157297823662689037894645226208583
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0x3c208c16d87cfd47,
0x97816a916871ca8d,
0xb85045b68181585d,
@ -35,7 +39,7 @@ impl FpParameters for FqParameters {
const REPR_SHAVE_BITS: u32 = 2;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0xd35d438dc58f0d9d,
0x0a78eb28f5c70b3d,
0x666ea36f7879462c,
@ -43,7 +47,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0xf32cfc5b538afa89,
0xb5e71911d44501fb,
0x47ab1eff0a417ff6,
@ -54,7 +58,7 @@ impl FpParameters for FqParameters {
// GENERATOR = 3
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0x7a17caa950ad28d7,
0x1f6ac17ae15521b9,
0x334bea4e696bd284,
@ -62,7 +66,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x9e10460b6c3e7ea3,
0xcbc0b548b438e546,
0xdc2822db40c0ac2e,
@ -74,7 +78,7 @@ impl FpParameters for FqParameters {
// T = (MODULUS - 1) // 2^S =
// 10944121435919637611123202872628637544348155578648911831344518947322613104291
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x9e10460b6c3e7ea3,
0xcbc0b548b438e546,
0xdc2822db40c0ac2e,
@ -84,7 +88,7 @@ impl FpParameters for FqParameters {
// (T - 1) // 2 =
// 5472060717959818805561601436314318772174077789324455915672259473661306552145
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x4f082305b61f3f51,
0x65e05aa45a1c72a3,
0x6e14116da0605617,

+ 12
- 9
bn254/src/fields/fr.rs

@ -1,4 +1,7 @@
use ark_ff::{biginteger::BigInteger256 as BigInteger, fields::*};
use ark_ff::{
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::*,
};
pub type Fr = Fp256<FrParameters>;
@ -11,7 +14,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 28;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
7164790868263648668u64,
11685701338293206998u64,
6216421865291908056u64,
@ -21,7 +24,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
4891460686036598785u64,
2896914383306846353u64,
13281191951274694749u64,
@ -37,7 +40,7 @@ impl FpParameters for FrParameters {
/// R = pow(2, 256) % MODULUS
/// = 6350874878119819312338956282401532410528162663560392320966563075034087161851
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
12436184717236109307u64,
3962172157175319849u64,
7381016538464732718u64,
@ -47,7 +50,7 @@ impl FpParameters for FrParameters {
/// R2 = R * R % MODULUS
/// = 944936681149208446651664254269745548490766851729442924617792859073125903783
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
1997599621687373223u64,
6052339484930628067u64,
10108755138030829701u64,
@ -59,7 +62,7 @@ impl FpParameters for FrParameters {
/// GENERATOR = 5
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
1949230679015292902u64,
16913946402569752895u64,
5177146667339417225u64,
@ -69,7 +72,7 @@ impl FpParameters for FrParameters {
/// (MODULUS - 1)/2 =
/// 10944121435919637611123202872628637544274182200208017171849102093287904247808
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xa1f0fac9f8000000,
0x9419f4243cdcb848,
0xdc2822db40c0ac2e,
@ -81,7 +84,7 @@ impl FpParameters for FrParameters {
/// T = (MODULUS - 1) / 2^s =
/// 81540058820840996586704275553141814055101440848469862132140264610111
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x9b9709143e1f593f,
0x181585d2833e8487,
0x131a029b85045b68,
@ -91,7 +94,7 @@ impl FpParameters for FrParameters {
/// (T - 1) / 2 =
/// 40770029410420498293352137776570907027550720424234931066070132305055
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xcdcb848a1f0fac9f,
0x0c0ac2e9419f4243,
0x098d014dc2822db4,

+ 5
- 5
bn254/src/fields/tests.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::{BigInteger, BigInteger256},
biginteger::{BigInt, BigInteger, BigInteger256},
fields::{
fp6_3over2::Fp6Parameters, FftField, FftParameters, Field, FpParameters, PrimeField,
SquareRootField,
@ -23,7 +23,7 @@ generate_field_serialization_test!(bn254; fq2; fq6; fq12;);
#[test]
fn test_fq_repr_from() {
assert_eq!(BigInteger256::from(100), BigInteger256([100, 0, 0, 0]));
assert_eq!(BigInteger256::from(100u64), BigInt::new([100, 0, 0, 0]));
}
#[test]
@ -40,9 +40,9 @@ fn test_fq_repr_is_odd() {
#[test]
fn test_fq_repr_is_zero() {
assert!(BigInteger256::from(0).is_zero());
assert!(!BigInteger256::from(1).is_zero());
assert!(!BigInteger256([0, 0, 1, 0]).is_zero());
assert!(BigInteger256::from(0u64).is_zero());
assert!(!BigInteger256::from(1u64).is_zero());
assert!(!BigInt::new([0, 0, 1, 0]).is_zero());
}
#[test]

+ 2
- 2
bw6_761/src/curves/mod.rs

@ -3,7 +3,7 @@ use ark_ec::{
bw6,
bw6::{BW6Parameters, TwistType, BW6},
};
use ark_ff::biginteger::BigInteger768 as BigInteger;
use ark_ff::{biginteger::BigInteger768 as BigInteger, BigInt};
pub mod g1;
pub mod g2;
@ -15,7 +15,7 @@ mod tests;
pub struct Parameters;
impl BW6Parameters for Parameters {
const X: BigInteger = BigInteger([
const X: BigInteger = BigInt::new([
0x8508c00000000001,
0x0,
0x0,

+ 9
- 9
bw6_761/src/fields/fq.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger768 as BigInteger,
biginteger::{BigInt, BigInteger768 as BigInteger},
field_new,
fields::{FftParameters, Fp768, Fp768Parameters, FpParameters},
};
@ -24,7 +24,7 @@ impl FftParameters for FqParameters {
// least_quadratic_nonresidue(MODULUS) in Sage.
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
17481284903592032950u64,
10104133845767975835u64,
8607375506753517913u64,
@ -42,7 +42,7 @@ impl FftParameters for FqParameters {
impl FpParameters for FqParameters {
/// MODULUS = 6891450384315732539396789682275657542479668912536150109513790160209623422243491736087683183289411687640864567753786613451161759120554247759349511699125301598951605099378508850372543631423596795951899700429969112842764913119068299
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0xf49d00000000008b,
0xe6913e6870000082,
0x160cf8aeeaf0a437,
@ -66,7 +66,7 @@ impl FpParameters for FqParameters {
// 2^768 % MODULUS
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
144959613005956565u64,
6509995272855063783u64,
11428286765660613342u64,
@ -83,7 +83,7 @@ impl FpParameters for FqParameters {
// R^2
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
14305184132582319705u64,
8868935336694416555u64,
9196887162930508889u64,
@ -104,7 +104,7 @@ impl FpParameters for FqParameters {
/// GENERATOR = 2
// primitive_root(MODULUS)
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
289919226011913130u64,
13019990545710127566u64,
4409829457611675068u64,
@ -121,7 +121,7 @@ impl FpParameters for FqParameters {
// (MODULUS - 1) / 2
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x7a4e800000000045,
0xf3489f3438000041,
0x0b067c577578521b,
@ -140,7 +140,7 @@ impl FpParameters for FqParameters {
// 3445725192157866269698394841137828771239834456268075054756895080104811711121745868043841591644705843820432283876893306725580879560277123879674755849562650799475802549689254425186271815711798397975949850214984556421382456559534149
// (MODULUS - 1) / 2 ^ TWO_ADICITY
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x7a4e800000000045,
0xf3489f3438000041,
0x0b067c577578521b,
@ -158,7 +158,7 @@ impl FpParameters for FqParameters {
// (T - 1)/2 =
// 1722862596078933134849197420568914385619917228134037527378447540052405855560872934021920795822352921910216141938446653362790439780138561939837377924781325399737901274844627212593135907855899198987974925107492278210691228279767074
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xbd27400000000022,
0xf9a44f9a1c000020,
0x05833e2bbabc290d,

+ 3
- 3
cp6_782/src/curves/mod.rs

@ -3,7 +3,7 @@ use ark_ff::{
biginteger::BigInteger832,
field_new,
fields::{BitIteratorBE, Field},
One,
BigInt, One,
};
use crate::{Fq, Fq3, Fq6, Fr, FQ_ONE, FQ_ZERO};
@ -182,7 +182,7 @@ pub const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = true;
/// FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0 =
/// 7000705447348627246181409558336018323010329260726930841638672011287206690002601216854775649561085256265269640040570922609783227469279331691880282815325569032149343779036142830666859805506518426649197067288711084398033
pub const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger832 = BigInteger832([
pub const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger832 = BigInt::new([
0xb62ef36af72855d1,
0x676b5cef49d290fa,
0xd17fcf3c60947427,
@ -200,7 +200,7 @@ pub const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger832 = BigInteger832([
/// FINAL_EXPONENT_LAST_CHUNK_W1 =
/// 86482221941698704497288378992285180119495364068003923046442785886272123124361700722982503222189455144364945735564951562986
pub const FINAL_EXPONENT_LAST_CHUNK_W1: BigInteger832 = BigInteger832([
pub const FINAL_EXPONENT_LAST_CHUNK_W1: BigInteger832 = BigInt::new([
0x5657b9b57b942aea,
0x84f9a65f3bd54eaf,
0x5ea4214e35cd127,

+ 9
- 9
cp6_782/src/fields/fq.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger832 as BigInteger,
biginteger::{BigInt, BigInteger832 as BigInteger},
fields::{FftParameters, Fp832, Fp832Parameters, FpParameters},
};
@ -17,7 +17,7 @@ impl FftParameters for FqParameters {
const TWO_ADICITY: u32 = 3;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
18044746167194862600u64,
63590321303744709u64,
5009346151370959890u64,
@ -36,7 +36,7 @@ impl FftParameters for FqParameters {
impl FpParameters for FqParameters {
/// MODULUS = 22369874298875696930346742206501054934775599465297184582183496627646774052458024540232479018147881220178054575403841904557897715222633333372134756426301062487682326574958588001132586331462553235407484089304633076250782629492557320825577
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0xdace79b57b942ae9,
0x545d85c16dfd424a,
0xee135c065f4d26b7,
@ -59,7 +59,7 @@ impl FpParameters for FqParameters {
const REPR_SHAVE_BITS: u32 = 50;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
11190988450819017841u64,
16170411717126802030u64,
2265463223430229059u64,
@ -76,7 +76,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
13983406830510863714u64,
17863856572171232656u64,
1698388424046564526u64,
@ -96,7 +96,7 @@ impl FpParameters for FqParameters {
/// GENERATOR = 13
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
16669393626057438558u64,
1640520694378723217u64,
1598646156981121135u64,
@ -113,7 +113,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x6d673cdabdca1574,
0xaa2ec2e0b6fea125,
0xf709ae032fa6935b,
@ -132,7 +132,7 @@ impl FpParameters for FqParameters {
// (T - 1)/2 =
// 1398117143679731058146671387906315933423474966581074036386468539227923378278626533764529938634242576261128410962740119034868607201414583335758422276643816405480145410934911750070786645716409577212967755581539567265673914343284832551598
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xadace79b57b942ae,
0x7545d85c16dfd424,
0xbee135c065f4d26b,
@ -151,7 +151,7 @@ impl FpParameters for FqParameters {
// T =
// 2796234287359462116293342775812631866846949933162148072772937078455846756557253067529059877268485152522256821925480238069737214402829166671516844553287632810960290821869823500141573291432819154425935511163079134531347828686569665103197
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x5b59cf36af72855d,
0xea8bb0b82dbfa849,
0x7dc26b80cbe9a4d6,

+ 8
- 8
ed_on_bls12_377/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::{FftParameters, Fp256, Fp256Parameters, FpParameters},
};
@ -14,7 +14,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 1;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
15170730761708361161u64,
13670723686578117817u64,
12803492266614043665u64,
@ -24,7 +24,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 2111115437357092606062206234695386632838870926408408195193685246394721360383
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
13356249993388743167u64,
5950279507993463550u64,
10965441865914903552u64,
@ -38,7 +38,7 @@ impl FpParameters for FrParameters {
const REPR_SHAVE_BITS: u32 = 5;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
16632263305389933622u64,
10726299895124897348u64,
16608693673010411502u64,
@ -46,7 +46,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
3987543627614508126u64,
17742427666091596403u64,
14557327917022607905u64,
@ -57,7 +57,7 @@ impl FpParameters for FrParameters {
// 70865795004005329077606947863872807680085016823885970091001235374859923341923
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
11289572479685143826u64,
11383637369941080925u64,
2288212753973340071u64,
@ -65,7 +65,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
6678124996694371583u64,
2975139753996731775u64,
14706092969812227584u64,
@ -74,7 +74,7 @@ impl FpParameters for FrParameters {
const T: BigInteger = Self::MODULUS_MINUS_ONE_DIV_TWO;
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xae56bba6b0cff67f,
0x14a4e8ebf10f22bf,
0x660b44d1e5c37b00,

+ 8
- 8
ed_on_bls12_381/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::{FftParameters, Fp256, Fp256Parameters, FpParameters},
};
@ -14,7 +14,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 1;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0xaa9f02ab1d6124de,
0xb3524a6466112932,
0x7342261215ac260b,
@ -24,7 +24,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 6554484396890773809930967563523245729705921265872317281365359162392183254199.
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0xd0970e5ed6f72cb7,
0xa6682093ccc81082,
0x6673b0101343b00,
@ -38,7 +38,7 @@ impl FpParameters for FrParameters {
const REPR_SHAVE_BITS: u32 = 4;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x25f80bb3b99607d9,
0xf315d62f66b6e750,
0x932514eeeb8814f4,
@ -46,7 +46,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0x67719aa495e57731,
0x51b0cef09ce3fc26,
0x69dab7fac026e9a5,
@ -56,14 +56,14 @@ impl FpParameters for FrParameters {
const INV: u64 = 0x1ba3a358ef788ef9;
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0x720b1b19d49ea8f1,
0xbf4aa36101f13a58,
0x5fa8cc968193ccbb,
0xe70cbdc7dccf3ac,
]);
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
7515249040934278747,
5995434913520945217,
9454073218019761536,
@ -72,7 +72,7 @@ impl FpParameters for FrParameters {
const T: BigInteger = Self::MODULUS_MINUS_ONE_DIV_TWO;
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
12980996557321915181,
2997717456760472608,
4727036609009880768,

+ 1
- 1
ed_on_bls12_381_bandersnatch/Cargo.toml

@ -15,7 +15,7 @@ ark-ff = { version = "^0.3.0", default-features = false }
ark-ec = { version = "^0.3.0", default-features = false }
ark-std = { version = "^0.3.0", default-features = false }
ark-r1cs-std = { version = "^0.3.0", default-features = false, optional = true }
ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "scalar_field" ] }
ark-bls12-381 = { version = "^0.3.0", path = "../bls12_381", default-features = false, features = [ "scalar_field" ] }
[dev-dependencies]
ark-relations = { version = "^0.3.0", default-features = false }

+ 9
- 9
ed_on_bls12_381_bandersnatch/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::{FftParameters, Fp256, Fp256Parameters, FpParameters},
};
@ -19,7 +19,7 @@ impl FftParameters for FrParameters {
/// 2^s root of unity computed by GENERATOR^t
/// 4740934665446857387895054948191089665295030226009829406950782728666658007874
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0xa4dcdba087826b42,
0x6e4ab162f57f862a,
0xabc5492749348d6a,
@ -30,7 +30,7 @@ impl FpParameters for FrParameters {
/// The modulus of the field.
/// MODULUS = 13108968793781547619861935127046491459309155893440570251786403306729687672801.
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0x74fd06b52876e7e1,
0xff8f870074190471,
0x0cce760202687600,
@ -52,7 +52,7 @@ impl FpParameters for FrParameters {
/// `R = M % Self::MODULUS`.
/// R = 10920338887063814464675503992315976178796737518116002025166357554075628257528
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x5817ca56bc48c0f8,
0x0383c7fc5f37dc74,
0x998c4fefecbc4ff8,
@ -62,7 +62,7 @@ impl FpParameters for FrParameters {
/// R2 = R^2 % Self::MODULUS
/// R2 = 4932290691328759802879919559207542894238895193980447506221046538067943049163
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0xdbb4f5d658db47cb,
0x40fa7ca27fecb938,
0xaa9e6daec0055cea,
@ -78,7 +78,7 @@ impl FpParameters for FrParameters {
/// `Self::MODULUS - 1`.
/// n = 9962557815892774795293348142308860067333132192265356416788884706064406244838
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0x56b6f3ab7b616de6,
0x114f419d6c9083e5,
0xbf518d217780c4b9,
@ -87,7 +87,7 @@ impl FpParameters for FrParameters {
/// (Self::MODULUS - 1) / 2
/// 6554484396890773809930967563523245729654577946720285125893201653364843836400
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xba7e835a943b73f0,
0x7fc7c3803a0c8238,
0x06673b0101343b00,
@ -97,7 +97,7 @@ impl FpParameters for FrParameters {
/// t for 2^s * t = MODULUS - 1, and t coprime to 2.
/// t = 409655274805673363120685472720202858103411121670017820368325103335302739775
/// = (modulus-1)/2^5
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x8ba7e835a943b73f,
0x07fc7c3803a0c823,
0x906673b0101343b0,
@ -106,7 +106,7 @@ impl FpParameters for FrParameters {
/// (t - 1) / 2
/// = 204827637402836681560342736360101429051705560835008910184162551667651369887
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xc5d3f41ad4a1db9f,
0x03fe3e1c01d06411,
0x483339d80809a1d8,

+ 9
- 9
ed_on_bn254/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::{FftParameters, Fp256, Fp256Parameters, FpParameters},
};
@ -14,7 +14,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 4;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0x1721ada8d4d27255,
0xcda0f5264e0e35bb,
0x961a936922086fe6,
@ -24,7 +24,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 2736030358979909402780800718157159386076813972158567259200215660948447373041
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0x677297dc392126f1,
0xab3eedb83920ee0a,
0x370a08b6d0302b0b,
@ -38,7 +38,7 @@ impl FpParameters for FrParameters {
const REPR_SHAVE_BITS: u32 = 5;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x073315dea08f9c76,
0xe7acffc6a098f24b,
0xf85a9201d818f015,
@ -46,7 +46,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0x35e44abee7ecb21e,
0x74646cacf5f84ec4,
0xe472df203faa158f,
@ -57,28 +57,28 @@ impl FpParameters for FrParameters {
#[rustfmt::skip]
/// GENERATOR = 31
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0x3c284f376f3993d1,
0x08bc9d93705cf8b8,
0x239d5fcbd9538f3e,
0x5ca4836185b994b,
]);
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x33b94bee1c909378,
0xd59f76dc1c907705,
0x9b85045b68181585,
0x30644e72e131a02,
]);
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0xa677297dc392126f,
0xbab3eedb83920ee0,
0x5370a08b6d0302b0,
0x60c89ce5c26340,
]);
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x533b94bee1c90937,
0x5d59f76dc1c90770,
0x29b85045b6818158,

+ 9
- 9
ed_on_cp6_782/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger384 as BigInteger,
biginteger::{BigInt, BigInteger384 as BigInteger},
fields::{FftParameters, Fp384, Fp384Parameters, FpParameters},
};
@ -14,7 +14,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 2u32;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
12119792640622387781u64,
8318439284650634613u64,
6931324077796168275u64,
@ -26,7 +26,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 32333053251621136751331591711861691692049189094364332567435817881934511297123972799646723302813083835942624121493
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
4684667634276979349u64,
3748803659444032385u64,
16273581227874629698u64,
@ -42,7 +42,7 @@ impl FpParameters for FrParameters {
const REPR_SHAVE_BITS: u32 = 10;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
12565484300600153878u64,
8749673077137355528u64,
9027943686469014788u64,
@ -52,7 +52,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
17257035094703902127u64,
16096159112880350050u64,
3498553494623421763u64,
@ -65,7 +65,7 @@ impl FpParameters for FrParameters {
// 2
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
1999556893213776791u64,
13750542494830678672u64,
1782306145063399878u64,
@ -75,7 +75,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
11565705853993265482u64,
1874401829722016192u64,
17360162650792090657u64,
@ -85,7 +85,7 @@ impl FpParameters for FrParameters {
]);
/// 8083263312905284187832897927965422923012297273591083141858954470483627824280993199911680825703270958985656030373
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
5782852926996632741,
10160572951715783904,
8680081325396045328,
@ -95,7 +95,7 @@ impl FpParameters for FrParameters {
]);
/// 4041631656452642093916448963982711461506148636795541570929477235241813912140496599955840412851635479492828015186
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
2891426463498316370,
5080286475857891952,
4340040662698022664,

+ 9
- 9
ed_on_mnt4_298/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger320 as BigInteger,
biginteger::{BigInt, BigInteger320 as BigInteger},
fields::{FftParameters, Fp320, Fp320Parameters, FpParameters},
};
@ -22,7 +22,7 @@ impl FftParameters for FrParameters {
// * R
// = 14596494758349247937872919467301196219547084259323651055171406111196152579418790325693086
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
4913018085921565342u64,
18164325898792356216u64,
11499902056485864693u64,
@ -41,7 +41,7 @@ impl FpParameters for FrParameters {
// 42373926857
// 96404785755712297250936212793128201320333033128042968811755970858369
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
15535567651727634391u64,
14992835038329117496u64,
12879083654034347181u64,
@ -60,7 +60,7 @@ impl FpParameters for FrParameters {
// 118980571542315331438337312413262112886281219744507561120271964887686106682370032123932631
// R = 104384076783966083500464392945960916666734135485183910065100558776489954102951241798239545
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
10622549565806069049u64,
15275253213246312896u64,
1379181597548482487u64,
@ -72,7 +72,7 @@ impl FpParameters for FrParameters {
// 118980571542315331438337312413262112886281219744507561120271964887686106682370032123932631
// R2 = 64940318866745953005690402896764745514897573584912026577721076893188083397226247459368768
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
16858329796171722560u64,
12060416575249219689u64,
17034911964548502611u64,
@ -88,7 +88,7 @@ impl FpParameters for FrParameters {
// I.e., write 7 * R =
// 16805108233870595873226876142153739349451629929242003734072122109313038626438499844081029
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
18037929197695780229u64,
16969762262749485294u64,
6166745553471500787u64,
@ -98,7 +98,7 @@ impl FpParameters for FrParameters {
// (n-1)/2 = 59490285771157665719168656206631056443140609872253780560135982443843053341185016061966315
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
7767783825863817195u64,
16719789556019334556u64,
15662913863871949398u64,
@ -108,7 +108,7 @@ impl FpParameters for FrParameters {
// t = (n - 1) / 2^{TWO_ADICITY} =
// 59490285771157665719168656206631056443140609872253780560135982443843053341185016061966315
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
7767783825863817195u64,
16719789556019334556u64,
15662913863871949398u64,
@ -117,7 +117,7 @@ impl FpParameters for FrParameters {
]);
// (t-1)/2 = 29745142885578832859584328103315528221570304936126890280067991221921526670592508030983157
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
3883891912931908597u64,
8359894778009667278u64,
17054828968790750507u64,

+ 9
- 9
ed_on_mnt4_753/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger768 as BigInteger,
biginteger::{BigInt, BigInteger768 as BigInteger},
fields::{FftParameters, Fp768, Fp768Parameters, FpParameters},
};
@ -22,7 +22,7 @@ impl FftParameters for FrParameters {
// * R
// = 3163945077843586747114473523156080008349200300253316071422414259389979351386670787753361998953450578171951209600907861296956453653582402723399808696724060539858637307706671971132333536614595846054039300191656599533885935499352
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
17630237153019476056u64,
13843632041501582123u64,
8277579215948731020u64,
@ -49,7 +49,7 @@ impl FpParameters for FrParameters {
// 12991385268608969143
// 743005941432538001939136029613828619428586060274612824031793373798492678674419102414979927623550862639644071557313558044209469997283394306590808303316688123808776073253386140931
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
1918157353135465345u64,
963476667289301255u64,
6719983938249379016u64,
@ -74,7 +74,7 @@ impl FpParameters for FrParameters {
// R = pow(2,768) % MODULUS
// R = 933352698056040166367534174176950366489065242993745918174914647273231163953185260894581718311971532174387033963715296372791285468903747270837716556902938133611910788060028435531754797383796835009316018259656953442114538695438
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
13829252738394483470u64,
3696102008259415033u64,
13727024804350215797u64,
@ -92,7 +92,7 @@ impl FpParameters for FrParameters {
// R2 = R * R % MODULUS
// R2 = 2468731867191023344597744941938926307216338526282824416880609839804154918771848044056240157551420210981962520047623686977567450338290776997282473798413876535168711321018336215486289519735826959884564283681071791441993286279295
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
10440129917231554687u64,
8797934528693354276u64,
14378434434829994158u64,
@ -115,7 +115,7 @@ impl FpParameters for FrParameters {
// I.e., write 5 * R =
// 4666763490280200831837670870884751832445326214968729590874573236366155819765926304472908591559857660871935169818576481863956427344518736354188582784514690668059553940300142177658773986918984175046580091298284767210572693477190
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
13806031470843762502u64,
33765967587523552u64,
13294891800622424138u64,
@ -132,7 +132,7 @@ impl FpParameters for FrParameters {
// (n-1)/2 = 2618655685494934587646513424452539820510669369997121816986468932564084550785694173316180860236896182588629435743027300328024462870030673754861143521533670625276320132154310648444223256908453586681062209256863600487696088740288
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
10182450713422508480u64,
481738333644650627u64,
12583364005979465316u64,
@ -149,7 +149,7 @@ impl FpParameters for FrParameters {
// t = (n - 1) / 2^{TWO_ADICITY} =
// 40916495085858352931976772257070934695479208906205028390413577071313821106026471458065325941201502852947334933484801567625382232344229277419705367523963603519942502064911103881940988389194587291891597019638493757620251386567
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
1023791920852361927u64,
10383820702924820450u64,
14608133870179016345u64,
@ -165,7 +165,7 @@ impl FpParameters for FrParameters {
]);
// (t-1)/2 = 20458247542929176465988386128535467347739604453102514195206788535656910553013235729032662970600751426473667466742400783812691116172114638709852683761981801759971251032455551940970494194597293645945798509819246878810125693283
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
511895960426180963u64,
14415282388317186033u64,
16527438971944283980u64,

+ 3
- 3
mnt4_298/src/curves/mod.rs

@ -1,5 +1,5 @@
use ark_ec::models::mnt4::{MNT4Parameters, MNT4};
use ark_ff::{biginteger::BigInteger320, field_new, Fp2};
use ark_ff::{biginteger::BigInteger320, field_new, BigInt, Fp2};
use crate::{Fq, Fq2, Fq2Parameters, Fq4Parameters, Fr};
@ -34,10 +34,10 @@ impl MNT4Parameters for Parameters {
const ATE_LOOP_COUNT: &'static [u64] = &[993502997770534912, 5071219579242586943, 2027349];
const ATE_IS_LOOP_COUNT_NEG: bool = false;
const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger320 = BigInteger320([0x1, 0x0, 0x0, 0x0, 0x0]);
const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger320 = BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0]);
const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = false;
const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger320 =
BigInteger320([993502997770534913, 5071219579242586943, 2027349, 0, 0]);
BigInt::new([993502997770534913, 5071219579242586943, 2027349, 0, 0]);
type Fp = Fq;
type Fr = Fr;
type Fp2Params = Fq2Parameters;

+ 10
- 10
mnt4_298/src/fields/fq.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger320 as BigInteger,
biginteger::{BigInt, BigInteger320 as BigInteger},
fields::{FftParameters, Fp320, Fp320Parameters, FpParameters},
};
@ -14,7 +14,7 @@ impl FftParameters for FqParameters {
const TWO_ADICITY: u32 = 17;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
9821480371597472441u64,
9468346035609379175u64,
9963748368231707135u64,
@ -32,7 +32,7 @@ impl FftParameters for FqParameters {
/// 381811485921190977554243339163030148371175054922689353173385941180422489253833691237722982
/// * R
/// = 260534023778902228073198316993669317435810479439368306496187170459125001342456918103569322
const LARGE_SUBGROUP_ROOT_OF_UNITY: Option<BigInteger> = Some(BigInteger([
const LARGE_SUBGROUP_ROOT_OF_UNITY: Option<BigInteger> = Some(BigInt::new([
7711798843682337706u64,
16456007754393011187u64,
7470854640069402569u64,
@ -43,7 +43,7 @@ impl FftParameters for FqParameters {
impl FpParameters for FqParameters {
/// MODULUS = 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758081
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
14487189785281953793u64,
4731562877756902930u64,
14622846468719063274u64,
@ -58,7 +58,7 @@ impl FpParameters for FqParameters {
const REPR_SHAVE_BITS: u32 = 22;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
1784298994435064924u64,
16852041090100268533u64,
14258261760832875328u64,
@ -67,7 +67,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
28619103704175136u64,
11702218449377544339u64,
7403203599591297249u64,
@ -78,7 +78,7 @@ impl FpParameters for FqParameters {
const INV: u64 = 12714121028002250751u64;
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
2709730703260633621u64,
13556085429182073539u64,
10903316137158576359u64,
@ -87,7 +87,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x70964866b2d38b3,
0x987520d4f1af2890,
0x2a47657764b1ae89,
@ -96,7 +96,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x384b24335969c59,
0xcc3a906a78d79448,
0x1523b2bbb258d744,
@ -105,7 +105,7 @@ impl FpParameters for FqParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x64866b2d38b30000,
0x20d4f1af28900709,
0x657764b1ae899875,

+ 9
- 9
mnt4_298/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger320 as BigInteger,
biginteger::{BigInt, BigInteger320 as BigInteger},
fields::{FftParameters, Fp320, Fp320Parameters, FpParameters},
};
@ -14,7 +14,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 34;
#[rustfmt::skip]
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0x818b361df1af7be4,
0x2ae2750d46a53957,
0x5784a8fe792c5f8a,
@ -25,7 +25,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
/// MODULUS = 475922286169261325753349249653048451545124878552823515553267735739164647307408490559963137
#[rustfmt::skip]
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0xbb4334a400000001,
0xfb494c07925d6ad3,
0xcaeec9635cf44194,
@ -40,7 +40,7 @@ impl FpParameters for FrParameters {
const REPR_SHAVE_BITS: u32 = 22;
#[rustfmt::skip]
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0xc3177aefffbb845c,
0x9b80c702f9961788,
0xc5df8dcdac70a85a,
@ -49,7 +49,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0x465a743c68e0596b,
0x34f9102adb68371,
0x4bbd6dcf1e3a8386,
@ -60,7 +60,7 @@ impl FpParameters for FrParameters {
const INV: u64 = 0xbb4334a3ffffffff;
#[rustfmt::skip]
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0xb1ddfacffd532b94,
0x25e295ff76674008,
0x8f00647b48958d36,
@ -69,7 +69,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xdda19a5200000000,
0x7da4a603c92eb569,
0x657764b1ae7a20ca,
@ -80,7 +80,7 @@ impl FpParameters for FrParameters {
// T and T_MINUS_ONE_DIV_TWO, where MODULUS - 1 = 2^S * T
#[rustfmt::skip]
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0xe4975ab4eed0cd29,
0xd73d10653ed25301,
0x69ec1523b2bbb258,
@ -89,7 +89,7 @@ impl FpParameters for FrParameters {
]);
#[rustfmt::skip]
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xf24bad5a77686694,
0x6b9e88329f692980,
0xb4f60a91d95dd92c,

+ 6
- 3
mnt4_753/src/curves/mod.rs

@ -1,5 +1,8 @@
use ark_ec::models::mnt4::{MNT4Parameters, MNT4};
use ark_ff::{biginteger::BigInteger768, field_new, Fp2};
use ark_ff::{
biginteger::{BigInt, BigInteger768},
field_new, Fp2,
};
use crate::{Fq, Fq2, Fq2Parameters, Fq4Parameters, Fr};
@ -42,9 +45,9 @@ impl MNT4Parameters for Parameters {
];
const ATE_IS_LOOP_COUNT_NEG: bool = true;
const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger768 =
BigInteger768([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = true;
const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInteger768([
const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInt::new([
8824542903220142079,
7711082599397206192,
8303354903384568230,

+ 10
- 10
mnt4_753/src/fields/fq.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger768 as BigInteger,
biginteger::{BigInt, BigInteger768 as BigInteger},
fields::{FftParameters, Fp768, Fp768Parameters, FpParameters},
};
@ -13,7 +13,7 @@ impl FftParameters for FqParameters {
const TWO_ADICITY: u32 = 15;
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0x3b079c7556ac378,
0x2c8c74d04a3f00d4,
0xd3b001061b90d4cf,
@ -32,7 +32,7 @@ impl FftParameters for FqParameters {
const SMALL_SUBGROUP_BASE_ADICITY: Option<u32> = Some(2);
/// LARGE_SUBGROUP_ROOT_OF_UNITY =
/// 12249458902762217747626832919710926618510011455364963726393752854649914979954138109976331601455448780251166045203053508523342111624583986869301658366625356826888785691823710598470775453742133593634524619429629803955083254436531
const LARGE_SUBGROUP_ROOT_OF_UNITY: Option<BigInteger> = Some(BigInteger([
const LARGE_SUBGROUP_ROOT_OF_UNITY: Option<BigInteger> = Some(BigInt::new([
8926681816978929800,
10873079436792120119,
6519893728366769435,
@ -49,7 +49,7 @@ impl FftParameters for FqParameters {
}
impl FpParameters for FqParameters {
/// MODULUS = 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888253786114353726529584385201591605722013126468931404347949840543007986327743462853720628051692141265303114721689601
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0x5e9063de245e8001,
0xe39d54522cdd119f,
0x638810719ac425f0,
@ -70,7 +70,7 @@ impl FpParameters for FqParameters {
const REPR_SHAVE_BITS: u32 = 15;
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x98a8ecabd9dc6f42,
0x91cd31c65a034686,
0x97c3e4a0cd14572e,
@ -85,7 +85,7 @@ impl FpParameters for FqParameters {
0x7b479ec8e242,
]);
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0x84717088cfd190c8,
0xc7d9ff8e7df03c0a,
0xa24bea56242b3507,
@ -102,7 +102,7 @@ impl FpParameters for FqParameters {
const INV: u64 = 0xf2044cfbe45e7fff;
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0xa8f627f0e629635e,
0x202afce346c36872,
0x85e1ece733493254,
@ -117,7 +117,7 @@ impl FpParameters for FqParameters {
0x11ca8d50bf627,
]);
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xaf4831ef122f4000,
0x71ceaa29166e88cf,
0x31c40838cd6212f8,
@ -136,7 +136,7 @@ impl FpParameters for FqParameters {
/// T = (MODULUS - 1) / 2^S =
/// 1278640471433073529124274133033466709233725278318907137200424283478556909563327233064541435662546964154604216671394463687571830033251476599169665701965732619291119517454523942352538645255842982596454713491581459512424155325
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x233ebd20c7bc48bd,
0x4be1c73aa8a459ba,
0xa948c71020e33588,
@ -153,7 +153,7 @@ impl FpParameters for FqParameters {
/// (T - 1) / 2 =
/// 639320235716536764562137066516733354616862639159453568600212141739278454781663616532270717831273482077302108335697231843785915016625738299584832850982866309645559758727261971176269322627921491298227356745790729756212077662
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x119f5e9063de245e,
0x25f0e39d54522cdd,
0x54a4638810719ac4,

+ 9
- 9
mnt4_753/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger768 as BigInteger,
biginteger::{BigInt, BigInteger768 as BigInteger},
fields::{FftParameters, Fp768, Fp768Parameters, FpParameters},
};
@ -13,7 +13,7 @@ impl FftParameters for FrParameters {
const TWO_ADICITY: u32 = 30;
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0x307f66b297671883,
0xd72a7f2b1e645f4e,
0x67079daa9a902283,
@ -30,7 +30,7 @@ impl FftParameters for FrParameters {
}
impl FpParameters for FrParameters {
/// MODULUS = 41898490967918953402344214791240637128170709919953949071783502921025352812571106773058893763790338921418070971888458477323173057491593855069696241854796396165721416325350064441470418137846398469611935719059908164220784476160001
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0xd90776e240000001,
0x4ea099170fa13a4f,
0xd6c381bc3f005797,
@ -51,7 +51,7 @@ impl FpParameters for FrParameters {
const REPR_SHAVE_BITS: u32 = 15;
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0xb99680147fff6f42,
0x4eb16817b589cea8,
0xa1ebd2d90c79e179,
@ -66,7 +66,7 @@ impl FpParameters for FrParameters {
0x7b479ec8e242,
]);
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0x3f9c69c7b7f4c8d1,
0x70a50fa9ee48d127,
0xcdbe6702009569cb,
@ -83,7 +83,7 @@ impl FpParameters for FrParameters {
const INV: u64 = 0xc90776e23fffffff;
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0xeee0a5d37ff6635e,
0xff458536cfa1cff4,
0x659af978d8169ab0,
@ -98,7 +98,7 @@ impl FpParameters for FrParameters {
0x11ca8d50bf627,
]);
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xec83bb7120000000,
0xa7504c8b87d09d27,
0x6b61c0de1f802bcb,
@ -117,7 +117,7 @@ impl FpParameters for FrParameters {
/// T = (MODULUS - 1) / 2^S =
/// 39021010480745652133919498688765463538626870065884617224134041854204007249857398469987226430131438115069708760723898631821547688442835449306011425196003537779414482717728302293895201885929702287178426719326440397855625
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x3e84e93f641ddb89,
0xfc015e5d3a82645c,
0xd264ea935b0e06f0,
@ -134,7 +134,7 @@ impl FpParameters for FrParameters {
/// (T - 1) / 2 =
/// 19510505240372826066959749344382731769313435032942308612067020927102003624928699234993613215065719057534854380361949315910773844221417724653005712598001768889707241358864151146947600942964851143589213359663220198927812
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x1f42749fb20eedc4,
0x7e00af2e9d41322e,
0x69327549ad870378,

+ 3
- 3
mnt6_298/src/curves/mod.rs

@ -1,4 +1,4 @@
use ark_ff::{biginteger::BigInteger320, field_new, Fp3};
use ark_ff::{biginteger::BigInteger320, field_new, BigInt, Fp3};
use ark_ec::{
models::mnt6::{MNT6Parameters, MNT6},
@ -32,10 +32,10 @@ impl MNT6Parameters for Parameters {
);
const ATE_LOOP_COUNT: &'static [u64] = &[0xdc9a1b671660000, 0x46609756bec2a33f, 0x1eef55];
const ATE_IS_LOOP_COUNT_NEG: bool = true;
const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger320 = BigInteger320([0x1, 0x0, 0x0, 0x0, 0x0]);
const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger320 = BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0]);
const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = true;
const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger320 =
BigInteger320([0xdc9a1b671660000, 0x46609756bec2a33f, 0x1eef55, 0x0, 0x0]);
BigInt::new([0xdc9a1b671660000, 0x46609756bec2a33f, 0x1eef55, 0x0, 0x0]);
type Fp = Fq;
type Fr = Fr;
type Fp3Params = Fq3Parameters;

+ 3
- 3
mnt6_753/src/curves/mod.rs

@ -2,7 +2,7 @@ use ark_ec::models::{
mnt6::{MNT6Parameters, MNT6},
SWModelParameters,
};
use ark_ff::{biginteger::BigInteger768, field_new, Fp3};
use ark_ff::{biginteger::BigInteger768, field_new, BigInt, Fp3};
use crate::{Fq, Fq3, Fq3Parameters, Fq6Parameters, Fr};
@ -46,9 +46,9 @@ impl MNT6Parameters for Parameters {
];
const ATE_IS_LOOP_COUNT_NEG: bool = false;
const FINAL_EXPONENT_LAST_CHUNK_1: BigInteger768 =
BigInteger768([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
BigInt::new([0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]);
const FINAL_EXPONENT_LAST_CHUNK_W0_IS_NEG: bool = false;
const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInteger768([
const FINAL_EXPONENT_LAST_CHUNK_ABS_OF_W0: BigInteger768 = BigInt::new([
8824542903220142080,
7711082599397206192,
8303354903384568230,

+ 9
- 10
pallas/src/fields/fq.rs

@ -1,8 +1,7 @@
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::{FftParameters, Fp256, Fp256Parameters},
};
pub type Fq = Fp256<FqParameters>;
pub struct FqParameters;
@ -15,7 +14,7 @@ impl FftParameters for FqParameters {
// TWO_ADIC_ROOT_OF_UNITY = GENERATOR^T
// Encoded in Montgomery form, so the value here is (5^T)R mod p.
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0xa28db849bad6dbf0,
0x9083cd03d3b539df,
0xfba6b9ca9dc8448e,
@ -25,7 +24,7 @@ impl FftParameters for FqParameters {
impl ark_ff::fields::FpParameters for FqParameters {
// 28948022309329048855892746252171976963363056481941560715954676764349967630337
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0x992d30ed00000001,
0x224698fc094cf91b,
0x0000000000000000,
@ -33,7 +32,7 @@ impl ark_ff::fields::FpParameters for FqParameters {
]);
// R = 2^256 mod p
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x34786d38fffffffd,
0x992c350be41914ad,
0xffffffffffffffff,
@ -41,14 +40,14 @@ impl ark_ff::fields::FpParameters for FqParameters {
]);
// R2 = (2^256)^2 mod p
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0x8c78ecb30000000f,
0xd7d30dbd8b0de0e7,
0x7797a99bc3c95d18,
0x096d41af7b9cb714,
]);
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xcc96987680000000,
0x11234c7e04a67c8d,
0x0000000000000000,
@ -56,14 +55,14 @@ impl ark_ff::fields::FpParameters for FqParameters {
]);
// T and T_MINUS_ONE_DIV_TWO, where MODULUS - 1 = 2^S * T
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x094cf91b992d30ed,
0x00000000224698fc,
0x0000000000000000,
0x0000000040000000,
]);
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x04a67c8dcc969876,
0x0000000011234c7e,
0x0000000000000000,
@ -72,7 +71,7 @@ impl ark_ff::fields::FpParameters for FqParameters {
// GENERATOR = 5
// Encoded in Montgomery form, so the value here is 5R mod p.
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0xa1a55e68ffffffed,
0x74c2a54b4f4982f3,
0xfffffffffffffffd,

+ 9
- 9
pallas/src/fields/fr.rs

@ -1,5 +1,5 @@
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
biginteger::{BigInt, BigInteger256 as BigInteger},
fields::{FftParameters, Fp256, Fp256Parameters, FpParameters},
};
@ -15,7 +15,7 @@ impl FftParameters for FrParameters {
// TWO_ADIC_ROOT_OF_UNITY = GENERATOR^T
// Encoded in Montgomery form, so the value here is (5^T)R mod q.
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInteger([
const TWO_ADIC_ROOT_OF_UNITY: BigInteger = BigInt::new([
0x218077428c9942de,
0xcc49578921b60494,
0xac2e5d27b2efbee2,
@ -25,7 +25,7 @@ impl FftParameters for FrParameters {
impl FpParameters for FrParameters {
// 28948022309329048855892746252171976963363056481941647379679742748393362948097
const MODULUS: BigInteger = BigInteger([
const MODULUS: BigInteger = BigInt::new([
0x8c46eb2100000001,
0x224698fc0994a8dd,
0x0000000000000000,
@ -33,7 +33,7 @@ impl FpParameters for FrParameters {
]);
// R = 2^256 mod q
const R: BigInteger = BigInteger([
const R: BigInteger = BigInt::new([
0x5b2b3e9cfffffffd,
0x992c350be3420567,
0xffffffffffffffff,
@ -41,14 +41,14 @@ impl FpParameters for FrParameters {
]);
// R2 = (2^256)^2 mod q
const R2: BigInteger = BigInteger([
const R2: BigInteger = BigInt::new([
0xfc9678ff0000000f,
0x67bb433d891a16e3,
0x7fae231004ccf590,
0x096d41af7ccfdaa9,
]);
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0xc623759080000000,
0x11234c7e04ca546e,
0x0000000000000000,
@ -57,14 +57,14 @@ impl FpParameters for FrParameters {
// T and T_MINUS_ONE_DIV_TWO, where MODULUS - 1 = 2^S * T
const T: BigInteger = BigInteger([
const T: BigInteger = BigInt::new([
0x0994a8dd8c46eb21,
0x00000000224698fc,
0x0000000000000000,
0x0000000040000000,
]);
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([
const T_MINUS_ONE_DIV_TWO: BigInteger = BigInt::new([
0x04ca546ec6237590,
0x0000000011234c7e,
0x0000000000000000,
@ -73,7 +73,7 @@ impl FpParameters for FrParameters {
// GENERATOR = 5
// Encoded in Montgomery form, so the value here is 5R mod q.
const GENERATOR: BigInteger = BigInteger([
const GENERATOR: BigInteger = BigInt::new([
0x96bc8c8cffffffed,
0x74c2a54b49f7778e,
0xfffffffffffffffd,

Loading…
Cancel
Save