Module algorithms
Expand description
⚠️ Collection of bignum algorithms.
Functions in this module are currently not considered part of the stable API
and may be changed or removed in future minor releases, without prior
notice.
Modules§
- div
- ⚠️ Collection of division algorithms.
Structs§
- Lehmer
Matrix - ⚠️ Lehmer update matrix
Functions§
- add_nx1
- ⚠️ Computes
lhs += a
and returns the carry. - addmul
- ⚠️ Computes
result += a * b
and checks for overflow. - addmul_
n - ⚠️ Computes wrapping
result += a * b
, with a fast-path for when all inputs are the same length and small enough. - addmul_
nx1 - ⚠️ Computes
lhs += a * b
and returns the carry. - borrowing_
sub - ⚠️ Sub with borrow.
- borrowing_
sub_ n - ⚠️
lhs -= rhs - borrow
- carrying_
add - ⚠️ Add with carry.
- carrying_
add_ n - ⚠️
lhs += rhs + carry
- cmp
- ⚠️ Compare two limb slices in reverse order.
- div
- ⚠️ Division with remainder.
- gcd
- ⚠️ Lehmer’s GCD algorithms.
- gcd_
extended - ⚠️ Lehmer’s extended GCD.
- inv_mod
- ⚠️ Modular inversion using extended GCD.
- mul_nx1
- ⚠️ Computes
lhs *= a
and returns the carry. - mul_
redc - ⚠️ Computes a * b * 2^(-BITS) mod modulus
- shift_
left_ small - ⚠️ Shift left small.
- shift_
right_ small - ⚠️ Shift right small.
- square_
redc - ⚠️ Computes a^2 * 2^(-BITS) mod modulus
- submul_
nx1 - ⚠️ Computes
lhs -= a * b
and returns the borrow.