mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-08 23:11:29 +01:00
BigInt fixes corresponding to algebra#372
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user