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

View File

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

View File

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