Settings
Help

Module algorithms

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§

LehmerMatrix
⚠️ 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.