Crates.io | scicrypt-bigint |
lib.rs | scicrypt-bigint |
version | 0.7.1 |
source | src |
created_at | 2022-09-11 18:11:59.746308 |
updated_at | 2022-09-14 13:55:34.258004 |
description | A scicrypt crate implementing *mostly* constant-time bigints for modular integers |
homepage | https://crates.io/crates/scicrypt-bigint |
repository | https://github.com/jellevos/scicrypt |
max_upload_size | |
id | 663162 |
size | 55,132 |
This is a part of scicrypt. For more information, head to the scicrypt crate homepage.
This crate implements a BigInteger
, for which most arithmetic operations take a constant amount of time given the specified sizes. This crate is nothing more than a convenient wrapper around the low-level constant-time functions from GMP.
If the crate is not working as expected, consider running with --debug
to hit the debug_assert!()
s, to check that the preconditions are met for some of the low-level functions.
Almost all function should run in constant-time, and only leak information about the length of the inputs. This also holds for overloaded operators (e.g. equality is constant-time). Some functions are not constant-time:
from_string
partial_cmp_leaky
lcm_leaky
mod_u_leaky
set_bit_leaky
and clear_bit_leaky
is_probably_prime_leaky
To make code easier to read, one can call leak()
on an UnsignedInteger
to get a LeakyUnsignedInteger
that supports overloaded operators for leaky operations.
We are unsure about random number generation. Also note that division may leak some information about the size of the resulting value.