reduce library

Constants

QINV → const int

Functions

barrettreduce(int a) int
Barrett reduce reduces the value 'a' modulo q using the Barrett approximation. This ensures the result is in 0, q-1.
fqmul(int a, int b) int
fqmul multiplies a*b modulo q using montgomeryreduce. It assumes that a and b are already reduced and in the range [0,q).
montgomeryreduce(int a) int
Montgomery reduce reduces a number a modulo q and reverses the Montgomery transform. It serves for efficient modular multiplications in the Montgomery domain.