MCPcopy Index your code
hub / github.com/RustCrypto/crypto-bigint

github.com/RustCrypto/crypto-bigint @v0.7.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.5 ↗ · + Follow
2,529 symbols 7,261 edges 211 files 225 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

RustCrypto: Cryptographic Big Integers

crate Docs Build Status codecov Apache2/MIT licensed Rust Version [Project Chat]chat-link

Pure Rust implementation of a big integer library which has been designed from the ground-up for use in cryptographic applications.

Provides constant-time, no_std-friendly implementations of modern formulas using const generics.

Documentation

Goals

  • Supports no_std-friendly const generic stack-allocated big integers.
  • Constant-time by default. Variable-time functions are explicitly marked as such.
  • Leverage what is possible today with const generics on stable rust.
  • Support const fn as much as possible with the goal of being able to compute values at compile-time.
  • Optional heap-allocated Boxed* types gated under an alloc feature.

Security Notes

This crate has been audited by NCC Group with no significant findings. We would like to thank Entropy for funding the audit. Note that the implementation has diverged significantly since the last audit.

All functions contained in the crate are designed to execute in constant time unless explicitly specified otherwise (via a *_vartime name suffix).

This library is NOT suitable for use on processors with a variable-time multiplication operation (e.g. short circuit on multiply-by-zero / multiply-by-one, such as certain 32-bit PowerPC CPUs and some non-ARM microcontrollers).

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:

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.

Extension points exported contracts — how you extend this code

Zero (Interface)
Zero values: additive identity element for `Self`. [12 implementers]
src/traits.rs
Encoding (Interface)
Encoding support. TODO(tarcieri): seal this trait in the next breaking release. [4 implementers]
src/encoding.rs
Retrieve (Interface)
A generalization for numbers kept in optimized representations (e.g. Montgomery) that can be converted back to the origi [3 …
src/modular.rs
DecodeByLimb (Interface)
Allow decoding of integers into fixed and variable-length types [2 implementers]
src/uint/encoding.rs
ConstMontyParams (Interface)
Trait representing a modulus and its associated constants for converting in and out of Montgomery form. To define a typ
src/modular/const_monty_form.rs
One (Interface)
One values: multiplicative identity element for `Self`. [16 implementers]
src/traits.rs
EncodedSize (Interface)
A trait mapping between encoded representations of integers.
src/encoding.rs
ConstPrimeMontyParams (Interface)
Trait representing a prime modulus and its associated constants for converting in and out of Montgomery form. To define
src/modular/const_monty_form.rs

Core symbols most depended-on inside this repo

as_mut_uint_ref
called by 151
src/uint/boxed.rs
select
called by 146
src/word.rs
nlimbs
called by 144
src/uint/boxed.rs
as_uint_ref
called by 132
src/uint/boxed.rs
as_ref
called by 120
src/uint/boxed.rs
as_nz_ref
called by 82
src/odd.rs
test
called by 78
src/int/gcd.rs
to_odd
called by 69
src/uint/boxed.rs

Shape

Method 1,463
Function 959
Interface 64
Class 39
Enum 4

Languages

Rust100%

Modules by API surface

src/traits.rs98 symbols
src/uint/encoding.rs71 symbols
src/uint/boxed.rs55 symbols
src/uint/div.rs52 symbols
src/non_zero.rs52 symbols
src/uint.rs48 symbols
src/odd.rs44 symbols
src/int.rs43 symbols
src/uint/boxed/encoding.rs41 symbols
src/wrapping.rs39 symbols
src/uint/mul.rs38 symbols
src/modular/bingcd/xgcd.rs35 symbols

For agents

$ claude mcp add crypto-bigint \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact