Skip to main content

Module mul

Module mul 

Source

FunctionsΒ§

almost_montgomery_mul πŸ”’
Computes an β€œalmost” Montgomery multiplication of x and y into out, that is out = x * y * 2^(-n*W) mod m + am assuming k = -1/m mod 2^W, where W is the bit size of the limb, and n * W is the full bit size of the integer.
almost_montgomery_reduce πŸ”’
Ensure the output of an β€œalmost” Montgomery multiplication is properly reduced.
montgomery_multiply_inner
Based on Algorithm 14.36 in Handbook of Applied Cryptography https://cacr.uwaterloo.ca/hac/about/chap14.pdf
mul_montgomery_form πŸ”’
Computes the Montgomery product of a and b modulo modulus, where a and b are in Montgomery form.
square_montgomery_form πŸ”’
Computes the Montgomery squaring of a modulo modulus where a is in Montgomery form.
square_repeat_montgomery_form πŸ”’
Computes a repeated Montgomery squaring of a modulo modulus where a is in Montgomery form.