2 releases

✓ Uses Rust 2018 edition

0.1.1 Oct 7, 2019
0.1.0 Oct 7, 2019

#49 in Math

Download history 7/week @ 2019-10-29 6/week @ 2019-11-05 5/week @ 2019-11-12 4/week @ 2019-11-19 6/week @ 2019-11-26 6/week @ 2019-12-03 99/week @ 2019-12-10 9/week @ 2019-12-17 5/week @ 2019-12-24 8/week @ 2019-12-31 154/week @ 2020-01-07 148/week @ 2020-01-14 1/week @ 2020-01-28 1/week @ 2020-02-04

73 downloads per month
Used in 6 crates



Unsigned 256-bit integers

Crates.io CircleCI Codecov

Implementation of 256-bit unsigned integers.

Warning. Side-channel resistance is currently not implemented. This library is optimized for performance and does not use slower side-channel resistant algorithms. Please evaluate the risks before using with sensitive data.

Note. Code coverage in Rust is still very early days. The above number is likely inaccurate. Please view the coverage report for details.


See CircleCI documentation on how to run tests locally.


Checkout master branch:

cargo bench --bench benchmark -- --save-baseline master
cargo bench --bench benchmark -- --baseline master
open target/criterion/report/index.html

Benchmarking using Mac OS' instrumentation. For this we need the cargo-instruments plugin for Cargo.

cargo install cargo-instruments

You can then run tests under profiling. It is recommended to filter for a specific test.

cargo instruments --release --bench benchmark --open [test name]


  • Perfomance optimized for Native and WebAssembly
  • Generality
  • Later: Constant-time operations.
  • Prefer const fn over procedural macros.

For optimization, there are a few different scenarios:

Note: The modulus is always assumed to be 256bit or less.

  • Programmer time known fields. The programmer can supply hand tuned optimized implementations of various algorithms. Ideally well performing defaults are provided.
  • Compiler time known fields. The compiler can compute constants, for example for Montgomery representation. The field parameters should be inlined.
  • Statically runtime known fields. Modulus is not known during compilation (but it's size is). Element membership of a particular field is known at compile time. The field parameters should statically allocated and the pointers inlined.
  • Dynamically runtime known fields. Modulus is not known during compilation (but its size is). Element membership of a particular field is not known at compile time. The field element should carry a pointer to the field parameters.

References and benchmarks



~49K SLoC