Search

Lib.rs

› Cryptography
#elliptic-curve #prime #ecc

no-std primefield

Generic implementation of prime fields built on crypto-bigint, along with macros for writing field element newtypes including ones with formally verified arithmetic using fiat-crypto

by Tony Arcieri, RustCrypto Developers (67 contributors)

  • Install
  • API reference
  • GitHub repo (rustcrypto)

17 releases

Uses new Rust 2024

0.14.0-rc.9 Apr 17, 2026
0.14.0-rc.8 Mar 10, 2026
0.14.0-rc.7 Feb 3, 2026
0.14.0-rc.2 Dec 30, 2025
0.0.0 Dec 17, 2023

#2823 in Cryptography

Download history 24891/week @ 2026-01-17 17785/week @ 2026-01-24 27763/week @ 2026-01-31 26355/week @ 2026-02-07 20544/week @ 2026-02-14 13010/week @ 2026-02-21 17873/week @ 2026-02-28 27017/week @ 2026-03-07 30384/week @ 2026-03-14 38993/week @ 2026-03-21 35985/week @ 2026-03-28 40912/week @ 2026-04-04 60791/week @ 2026-04-11 51854/week @ 2026-04-18 61493/week @ 2026-04-25 68024/week @ 2026-05-02

250,826 downloads per month
Used in 40 crates (2 directly)

Apache-2.0 OR MIT

84KB
2K SLoC

RustCrypto: Generic Prime Fields

crate Docs Build Status Apache2/MIT licensed Rust Version Project Chat

Generic implementation of prime fields built on crypto-bigint, along with macros for writing field element newtypes including ones with formally verified arithmetic using fiat-crypto.

Documentation

About

A prime field is a finite field of order 𝑝, where 𝑝 is a prime number. Because 𝑝 is prime, every non-zero element of the field has a modular inverse.

Prime fields are notable for their use in cryptography, particularly for their use as coordinates (a.k.a. base field) and the scalar field of elliptic curve implementations.

The implementation provided by this crate is built on crypto_bigint::modular, which provides a generic implementation of modular arithmetic with a modulus fixed at compile-time.

Minimum Supported Rust Version (MSRV) Policy

MSRV increases are not considered breaking changes and can happen in patch releases.

The crate MSRV accounts for all supported targets and crate feature combinations, excluding explicitly unstable features.

License

Licensed under either of:

  • Apache License, Version 2.0
  • MIT license

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2.5MB
~55K SLoC

  • crypto-bigint 0.7.1+rand_core+hybrid-array+subtle
  • crypto-common 0.2+rand_core
  • rand_core 0.10
  • rustcrypto-ff
  • subtle+const-generics
  • zeroize
Related: x448, sec1, ecdsa, rustcrypto-ff, bign256, bignp256, bp256, bp384, ed448-goldilocks, elliptic-curve, hash2curve, k256, p192, primeorder, p224, p256, p384, p521, sm2
See also: ff, neptune, goldilocks-ntt-hdl, ring, ed25519-dalek, ark-ff, ark-secp256k1, ark-secp256r1

Lib.rs is an unofficial list of Rust/Cargo crates, created by kornelski. It contains data from multiple sources, including heuristics, and manually curated data. Content of this page is not necessarily endorsed by the authors of the crate. This site is not affiliated with nor endorsed by the Rust Project. If something is missing or incorrect, please file a bug.