Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 13 additions & 25 deletions fields/U1024.nr
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::utils::u60_representation::U60Repr;
pub struct U1024Params {}
impl RuntimeBigNumParamsTrait<9> for U1024Params {
fn modulus_bits() -> u32 {
1025
}
}
impl BigNumParamsTrait<9> for U1024Params {
fn get_instance() -> BigNumInstance<9, Self> {
U1024_Instance
}
fn modulus_bits() -> u32 {
1025
}
}
pub global U1024_Instance: BigNumInstance<9, U1024Params> = BigNumInstance {
use crate::bignum::BigNum;
use crate::bignum::derive_bignum;
use crate::params::BigNumParams;

pub global U1024_PARAMS: BigNumParams<9, 1025> = BigNumParams {
has_multiplicative_inverse: false,
modulus: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x010000000000000000
],
double_modulus: [
0x01000000000000000000000000000000, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0x01ffffffffffffffff
],
modulus_u60: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10]},
modulus_u60_x4: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] },
redc_param: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x400000000000000000
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01000000000000000000
]
};
};

#[derive_bignum(9, 1025, quote { U1024_PARAMS })]
pub struct U1024 {limbs: [u128; 9]}


38 changes: 13 additions & 25 deletions fields/U2048.nr
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::utils::u60_representation::U60Repr;
pub struct U2048Params {}
impl RuntimeBigNumParamsTrait<18> for U2048Params {
fn modulus_bits() -> u32 {
2049
}
}
impl BigNumParamsTrait<18> for U2048Params {
fn get_instance() -> BigNumInstance<18, Self> {
U2048_Instance
}
fn modulus_bits() -> u32 {
2049
}
}
pub global U2048_Instance: BigNumInstance<18, U2048Params> = BigNumInstance {
use crate::bignum::BigNum;
use crate::bignum::derive_bignum;
use crate::params::BigNumParams;

pub global U2048_PARAMS: BigNumParams<18, 2049> = BigNumParams {
has_multiplicative_inverse: false,
modulus: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0100
],
double_modulus: [
0x01000000000000000000000000000000, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0x01ff
],
modulus_u60: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0100, 0x00]},
modulus_u60_x4: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0100, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] },
redc_param: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4000
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x010000
]
};
};

#[derive_bignum(18, 2049, quote { U2048_PARAMS })]
pub struct U2048 {limbs: [u128; 18]}


38 changes: 13 additions & 25 deletions fields/U256.nr
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::utils::u60_representation::U60Repr;
pub struct U256Params {}
impl RuntimeBigNumParamsTrait<3> for U256Params {
fn modulus_bits() -> u32 {
257
}
}
impl BigNumParamsTrait<3> for U256Params {
fn get_instance() -> BigNumInstance<3, Self> {
U256_Instance
}
fn modulus_bits() -> u32 {
257
}
}
pub global U256_Instance: BigNumInstance<3, U256Params> = BigNumInstance {
use crate::bignum::BigNum;
use crate::bignum::derive_bignum;
use crate::params::BigNumParams;

pub global U256_PARAMS: BigNumParams<3, 257> = BigNumParams {
has_multiplicative_inverse: false,
modulus: [
0x00, 0x00, 0x010000
],
double_modulus: [
0x01000000000000000000000000000000, 0xffffffffffffffffffffffffffffff, 0x01ffff
],
modulus_u60: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x010000, 0x00]},
modulus_u60_x4: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x010000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] },
redc_param: [
0x00, 0x00, 0x400000
0x00, 0x00, 0x01000000
]
};
};

#[derive_bignum(3, 257, quote { U256_PARAMS })]
pub struct U256 {limbs: [u128; 3]}


38 changes: 13 additions & 25 deletions fields/U384.nr
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::utils::u60_representation::U60Repr;
pub struct U384Params {}
impl RuntimeBigNumParamsTrait<4> for U384Params {
fn modulus_bits() -> u32 {
385
}
}
impl BigNumParamsTrait<4> for U384Params {
fn get_instance() -> BigNumInstance<4, Self> {
U384_Instance
}
fn modulus_bits() -> u32 {
385
}
}
pub global U384_Instance: BigNumInstance<4, U384Params> = BigNumInstance {
use crate::bignum::BigNum;
use crate::bignum::derive_bignum;
use crate::params::BigNumParams;

pub global U384_PARAMS: BigNumParams<4, 385> = BigNumParams {
has_multiplicative_inverse: false,
modulus: [
0x00, 0x00, 0x00, 0x01000000
],
double_modulus: [
0x01000000000000000000000000000000, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0x01ffffff
],
modulus_u60: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01000000, 0x00]},
modulus_u60_x4: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01000000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] },
redc_param: [
0x00, 0x00, 0x00, 0x40000000
0x00, 0x00, 0x00, 0x0100000000
]
};
};

#[derive_bignum(4, 385, quote { U384_PARAMS })]
pub struct U384 {limbs: [u128; 4]}


38 changes: 13 additions & 25 deletions fields/U4096.nr
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::utils::u60_representation::U60Repr;
pub struct U4096Params {}
impl RuntimeBigNumParamsTrait<35> for U4096Params {
fn modulus_bits() -> u32 {
4097
}
}
impl BigNumParamsTrait<35> for U4096Params {
fn get_instance() -> BigNumInstance<35, Self> {
U4096_Instance
}
fn modulus_bits() -> u32 {
4097
}
}
pub global U4096_Instance: BigNumInstance<35, U4096Params> = BigNumInstance {
use crate::bignum::BigNum;
use crate::bignum::derive_bignum;
use crate::params::BigNumParams;

pub global U4096_PARAMS: BigNumParams<35, 4097> = BigNumParams {
has_multiplicative_inverse: false,
modulus: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x010000
],
double_modulus: [
0x01000000000000000000000000000000, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0x01ffff
],
modulus_u60: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x010000, 0x00]},
modulus_u60_x4: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x010000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] },
redc_param: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x400000
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01000000
]
};
};

#[derive_bignum(35, 4097, quote { U4096_PARAMS })]
pub struct U4096 {limbs: [u128; 35]}


38 changes: 13 additions & 25 deletions fields/U512.nr
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::utils::u60_representation::U60Repr;
pub struct U512Params {}
impl RuntimeBigNumParamsTrait<5> for U512Params {
fn modulus_bits() -> u32 {
513
}
}
impl BigNumParamsTrait<5> for U512Params {
fn get_instance() -> BigNumInstance<5, Self> {
U512_Instance
}
fn modulus_bits() -> u32 {
513
}
}
pub global U512_Instance: BigNumInstance<5, U512Params> = BigNumInstance {
use crate::bignum::BigNum;
use crate::bignum::derive_bignum;
use crate::params::BigNumParams;

pub global U512_PARAMS: BigNumParams<5, 513> = BigNumParams {
has_multiplicative_inverse: false,
modulus: [
0x00, 0x00, 0x00, 0x00, 0x0100000000
],
double_modulus: [
0x01000000000000000000000000000000, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0x01ffffffff
],
modulus_u60: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0100000000, 0x00]},
modulus_u60_x4: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0100000000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] },
redc_param: [
0x00, 0x00, 0x00, 0x00, 0x4000000000
0x00, 0x00, 0x00, 0x00, 0x010000000000
]
};
};

#[derive_bignum(5, 513, quote { U512_PARAMS })]
pub struct U512 {limbs: [u128; 5]}


38 changes: 13 additions & 25 deletions fields/U768.nr
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@

use crate::BigNumParamsTrait;
use crate::runtime_bignum::BigNumInstance;
use crate::runtime_bignum::BigNumParamsTrait as RuntimeBigNumParamsTrait;
use crate::utils::u60_representation::U60Repr;
pub struct U768Params {}
impl RuntimeBigNumParamsTrait<7> for U768Params {
fn modulus_bits() -> u32 {
769
}
}
impl BigNumParamsTrait<7> for U768Params {
fn get_instance() -> BigNumInstance<7, Self> {
U768_Instance
}
fn modulus_bits() -> u32 {
769
}
}
pub global U768_Instance: BigNumInstance<7, U768Params> = BigNumInstance {
use crate::bignum::BigNum;
use crate::bignum::derive_bignum;
use crate::params::BigNumParams;

pub global U768_PARAMS: BigNumParams<7, 769> = BigNumParams {
has_multiplicative_inverse: false,
modulus: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01000000000000
],
double_modulus: [
0x01000000000000000000000000000000, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffff, 0x01ffffffffffff
],
modulus_u60: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01000000000000, 0x00]},
modulus_u60_x4: U60Repr { limbs: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01000000000000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] },
redc_param: [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40000000000000
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0100000000000000
]
};
};

#[derive_bignum(7, 769, quote { U768_PARAMS })]
pub struct U768 {limbs: [u128; 7]}


Loading