-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement
FieldParameters
trait for Secp256r1BaseField
struct
- Loading branch information
1 parent
0d22fc2
commit a266aab
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
use num::BigUint; | ||
use serde::{Deserialize, Serialize}; | ||
use sp1_core::utils::ec::field::{FieldParameters, MAX_NB_LIMBS}; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] | ||
pub struct Secp256r1Parameters; | ||
|
||
#[derive(Debug, Default, Clone, Copy, PartialEq, Serialize, Deserialize)] | ||
pub struct Secp256r1BaseField; | ||
|
||
impl FieldParameters for Secp256r1BaseField { | ||
const NB_BITS_PER_LIMB: usize = 16; | ||
|
||
const NB_LIMBS: usize = 16; | ||
|
||
const NB_WITNESS_LIMBS: usize = 2 * Self::NB_LIMBS - 2; | ||
|
||
const MODULUS: [u8; MAX_NB_LIMBS] = [ | ||
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
0xFF, 0xFC, | ||
]; | ||
|
||
const WITNESS_OFFSET: usize = 1usize << 14; | ||
} | ||
|
||
fn main() {} |