Skip to content

Commit

Permalink
fr wip
Browse files Browse the repository at this point in the history
  • Loading branch information
TalDerei committed Jan 12, 2024
1 parent 810e68f commit c35b6e0
Show file tree
Hide file tree
Showing 7 changed files with 1,238 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fields/fq/arkworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl PrimeField for Fq {
/// A `BigInteger` type that can represent elements of this field.
type BigInt = BigInt<4>;

/// The BLS12-377 base field modulus `p` = 0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c0000000000
/// The BLS12-377 base field modulus `p` = 0x12ab655e9a2ca55660b44d1e5c37b00159aa76fed00000010a11800000000001
const MODULUS: Self::BigInt = ark_ff::BigInt(MODULUS_LIMBS);

/// The value `(p - 1)/ 2`.
Expand Down
30 changes: 30 additions & 0 deletions src/fields/fr.rs
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
// Fiat-crypto generates some unused type aliases, but we don't want to edit the generated code at all.
#![allow(dead_code)]

use cfg_if::cfg_if;

pub mod arkworks;
pub mod u32;
pub mod u64;

#[cfg(all(not(feature = "u32_backend"), not(feature = "u64_backend")))]
// compile_error!("No backend selected. Please select either: 'u32_backend' or 'u64_backend'.");
#[cfg(all(feature = "u32", feature = "u64"))]
compile_error!(
"Multiple backends selected. Please select only one: 'u32_backend' or 'u64_backend'."
);

cfg_if! {
if #[cfg(feature = "u32_backend")] {
pub type Fr = u32::Fr;

pub mod arkworks_constants {
pub use super::u32::arkworks_constants::*;
}
} else {
pub type Fr = u64::Fr;

pub mod arkworks_constants {
pub use super::u64::arkworks_constants::*;
}
}
}
Loading

0 comments on commit c35b6e0

Please sign in to comment.