The crypto-bigint
library in Rust is designed for fixed-precision arithmetic on arbitrary sized integers, particularly focused on cryptographic applications where constant-time operation on secret values (e.g. keys, plaintexts) is required. It provides a high-level API for performing mathematical operations on big integers, which are too large for the native integer types (e.g. u32
, u64
, u128
) in Rust.
- repo: https://github.com/RustCrypto/crypto-bigint
- crate: https://crates.io/crates/crypto-bigint/0.6.0
- docs: https://docs.rs/crypto-bigint/0.6.0
This release includes a large amount of new functionality including fully-featured heap-allocated unsigned integer support (i.e. BoxedUint
) as well as initial support for stack-allocated signed integers (i.e. Int
) using a two's complement representation. Heap allocated integers are needed to support large numbers of varying key sizes, such as are used by the RSA and DSA algorithms. A PR is open to migrate the RustCrypto rsa
crate to use crypto-bigint
.
This augments the existing stack-allocated Uint
type which is both "heapless" no_std
and const fn
friendly.
Extensive support for modular arithmetic can be found under the crypto_bigint::modular
module, which contains support for Montgomery form.
The complementary crypto-primes
library (release with v0.6 support forthcoming) provides various prime number algorithms.
Enjoy!
1 post - 1 participant
Source: View source