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