ecrust-fp
Finite-field arithmetic for the ecrust ecosystem.
This crate is the lowest layer of the project and provides reusable field types and traits for prime fields, binary fields, and extension fields.
What is in this crate?
FieldOps: shared trait for field arithmeticFpElement<MOD, LIMBS>: elements of a prime field $\mathbb{F}_p$FpExt<...>: extension fields over prime fieldsF2Element: the binary field $\mathbb{F}_2$F2Ext<...>: binary extension fields $\mathbb{F}_{2^m}$
Adding it to your project
Because the published package name is ecrust-fp while the library crate name is fp, the most convenient dependency declaration is:
[]
= { = "ecrust-fp", = "0.1" }
If you prefer a single entry point, you can also depend on the umbrella crate:
[]
= "0.1"
and then use ecrust::fp.
Minimal example
use ;
use FieldOps;
use FpElement;
const_prime_monty_params!;
type F19 = ;
let a = F19from_u64;
let b = F19from_u64;
let c = a * b;
assert_eq!;
let inv = a.invert.into_option.unwrap;
assert!;
Status
ecrust-fp is currently the most mature layer in the workspace, but the project as a whole is still in alpha. APIs may evolve, and the code should be treated as experimental rather than production-hardened.
Related crates
ecrust-ec: elliptic-curve abstractions built on top of this crateecrust-isogeny: isogeny scaffolding built on top offpandececrust-protocol: higher-level elliptic-curve protocolsecrust: umbrella crate re-exporting the full stack
Authors
- Gustavo Banegas
- Martin Azon
- Sam Frengley
License
Apache-2.0