Team-Fly
Previous Section Next Section

B.6 Modular Arithmetic: Friend Functions

const LINT
mod (const LINT& a,
     const LINT& m);

remainder b = mod (a, m);

const LINT
mod2 (const LINT& a,
     const USHORT u);

remainder modulo power of two 2u, b = mod (a, u);

const int
mequ (const LINT& a,
     const LINT& b,
     const LINT& m);

comparison of a and b modulo m if (mequ (a, b, m)) ...

const LINT
madd (const LINT& a,
     const LINT& b,
     const LINT& m);

modular addition, c = madd (a, b, m);

const LINT
msub (const LINT& a,
     const LINT& b,
     const LINT& m);

modular subtraction, c = msub(a, b, m);

const LINT
mmul (const LINT& a,
     const LINT& b,
     const LINT& m);

modular multiplication, c = mmul (a, b, m);

const LINT
msqr (const LINT& a,
     const LINT& m);

modular squaring, c = msqr (a, m);

const LINT
mexp (const LINT& a,
     const LINT& e,
     const LINT& m);

modular exponentiation with Montgomery reduction for odd modulus m, c = mexp (a, e, m);

const LINT
mexp (const USHORT u,
     const LINT& e,
     const LINT& m);

modular exponentiation with USHORT base, Montgomery reduction for odd modulus m, c = mexp (u, e, m);

const LINT
mexp (const LINT& a,
     const USHORT u,
     const LINT& m);

modular exponentiation with USHORT exponent, Montgomery reduction for odd modulus m, c = mexp (a, u, m);

const LINT
mexp5m (const LINT& a,
     const LINT& e,
     const LINT& m);

modular exponentiation with Montgomery reduction, only for odd modulus m, c = mexp5m (a, e, m);

const LINT
mexpkm (const LINT& a,
     const LINT& b,
     const LINT& m);

modular exponentiation with Montgomery reduction, only for odd modulus m, c = mexpkm (a, e, m);

const LINT
mexp2 (const LINT& a,
     const USHORT u,
     const LINT& m);

modular exponentiation with power of two exponent 2u, c = mexp2 (a, u, m);


Team-Fly Previous Section Next Section