BigInt fixes corresponding to algebra#372

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
Marcin
2022-01-10 20:03:40 +01:00
committed by GitHub
parent d1ced15cc2
commit 6a5cf1d84a
32 changed files with 315 additions and 307 deletions

View File

@@ -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;

View File

@@ -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,

View File

@@ -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,