#unsigned-integer #algebra #u256 #no-std

no-std zkp-u256

Performant implementation of 256-bit unsigned integers

4 releases

0.2.1 Dec 24, 2020
0.2.0 Oct 19, 2020
0.1.1 Oct 7, 2019
0.1.0 Oct 7, 2019

#443 in Math

Download history 13/week @ 2024-01-01 66/week @ 2024-01-08 69/week @ 2024-01-15 96/week @ 2024-01-22 127/week @ 2024-01-29 23/week @ 2024-02-05 16/week @ 2024-02-12 21/week @ 2024-02-19 72/week @ 2024-02-26 177/week @ 2024-03-04 50/week @ 2024-03-11 53/week @ 2024-03-18 140/week @ 2024-03-25 71/week @ 2024-04-01 56/week @ 2024-04-08 96/week @ 2024-04-15

363 downloads per month
Used in 10 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.

Feature flags

  • std Build using libstd. (enabled by default)
  • inline Inline small operations like bitshifts, addition, multiplication, etc. This leads to better performance at the cost of larger code size. You can always force inlining by using the _inline suffixed version of the operations. (enabled by default)
  • use_rand Add support for the rand crate to generate random numbers.


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]


~44K SLoC