Team-Fly
Previous Section Next Section

A.3 Modular Arithmetic

int
mod_l (CLINT d_l, CLINT n_l,
    CLINT r_l);

residue of d_l mod n_l, output in r_l

USHORT
umod_l (CLINT d_l, USHORT n);

residue d_l mod n

int
mod2_l (CLINT d_l, ULONG k,
    CLINT r_l);

residue d_l mod 2k

int
mequ_l (CLINT a_l, CLINT b_l,
    CLINT m_l);

test for equality of a_l and b_l modulo m_l

int
madd_l (CLINT a_l, CLINT b_l,
    CLINT c_l, CLINT m_l);

modular addition: addition of a_l and b_l modulo m_l, output in c_l

int
umadd_l (CLINT a_l, USHORT b,
     CLINT c_l, CLINT m_l);

mixed modular addition: addition of a_l and b mod m_l, output in c_l

int
msub_l (CLINT a_l, CLINT b_l,
     CLINT c_l, CLINT m_l);

modular subtraction: subtraction of a_l and b_l mod m_l, output in c_l

int
umsub_l (CLINT a_l, USHORT b,
     CLINT c_l, CLINT m_l);

mixed modular subtraction: subtraction of a_l and b mod m_l, output in c_l

int
mmul_l (CLINT a_l, CLINT b_l,
     CLINT c_l, CLINT m_l);

modular multiplication: multiplication of a_l and b_l mod m_l, output in c_l

void
mulmon_l (CLINT a_l,
     CLINT b_l, CLINT n_l,
     USHORT nprime,
     USHORT log B_r,
     CLINT p_l);

modular multiplication of a_l and b_l mod n_l, product in p_l (Montgomery method, Blog B_r1 n_l < Blog B_r)

void
sqrmon_l (CLINT a_l,
     CLINT n_l, USHORT nprime,
     USHORT logB_r,
     CLINT p_l);

modular squaring of a_l mod n_l, square in p_l (Montgomery method, Blog B_r1 n_l < Blog B_r)

int
ummul_l (CLINT a_l, USHORT b,
     CLINT p_l, CLINT m_l);

mixed modular multiplication of a_l and b_l mod n_l, product in p_l

int
msqr_l (CLINT a_l, CLINT c_l,
     CLINT m_l);

modular squaring of a_l mod n_l, square in p_l

int
mexp5_l (CLINT bas_l,
     CLINT exp_l, CLINT p_l,
     CLINT m_l);

modular exponentiation, 25-ary method

int
mexpk_l (CLINT bas_l,
     CLINT exp_l,CLINT p_l,
     CLINT m_l);

modular exponentiation, 2k-ary method, dynamic memory with malloc()

int
mexp5m_l (CLINT bas_l,
     CLINT exp_l, CLINT p_l,
     CLINT m_l);

Montgomery exponentiation, 25-ary method, odd modulus

int
mexpkm_l (CLINT bas_l,
     CLINT exp_l, CLINT p_l,
     CLINT m_l);

Montgomery exponentiation, 25-ary method, odd modulus

int
umexp_l (CLINT bas_l,
     USHORT e, CLINT p_l,
     CLINT m_l);

modular exponentiation, USHORT exponent

int
umexpm_l (CLINT bas_l,
     USHORT e, CLINT p_l,
     CLINT m_l);

modular exponentiation, odd modulus, USHORT exponent

int
wmexp_l (USHORT bas,
     CLINT e_l, CLINT p_l,
     CLINT m_l);

modular exponentiation, USHORT base

int
wmexpm_l (USHORT bas,
     CLINT e_l, CLINT p_l,
     CLINT m_l);

Montgomery exponentiation, odd modulus, USHORT base

int
mexp2_l (CLINT bas_l,
     USHORT e, CLINT p_l,
     CLINT m_l);

modular exponentiation, exponent e a power of 2

int
mexp_l (CLINT bas_l,
     CLINT e_l, CLINT p_l,
     CLINT m_l);

modular exponentiation, automatic use of mexpkm_l() if modulus odd, otherwise mexpk_l()


Team-Fly Previous Section Next Section