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 += aand returns the carry. - addmul
- ⚠️ Computes
result += a * band 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 * band 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.
- ge
- Compare two limb slices in reverse order, returns
trueifa >= b. - gt
- Compare two limb slices in reverse order, returns
trueifa > b. - inv_mod
- ⚠️ Modular inversion using extended GCD.
- le
- Compare two limb slices in reverse order, returns
trueifa <= b. - lt
- Compare two limb slices in reverse order, returns
trueifa < b. - mul_nx1
- ⚠️ Computes
lhs *= aand returns the carry. - mul_
redc - ⚠️ Computes a * b * 2^(-BITS) mod modulus
- square_
redc - ⚠️ Computes a^2 * 2^(-BITS) mod modulus
- submul_
nx1 - ⚠️ Computes
lhs -= a * band returns the borrow.