Cryptography Reference
In-Depth Information
Function:
residue modulo a power of 2
const LINT&
LINT::mod2 (USHORT e)
Syntax:
Input:
implicit argument (dividend)
e
(exponent of the power of 2 divisor)
Return:
pointer to the implicit argument, which contains the
remainder of the division modulo
2
e
Example:
a.mod 2(e);
executes the operation
a%=d;
,
where
d=
2
e
mod2
cannot be created by overloading the
previously presented function
mod()
,since
mod()
also
accepts a
USHORT
argument, which is changed
automatically into a
LINT
object by means of the
appropriate constructor. Since it cannot be
determined from the arguments which function
is meant,
mod2()
is given its own name.
Note:
test for equality modulo
m
Function:
int
LINT::mequ (const LINT& b, const LINT& m);
Syntax:
implicit argument
a
second argument
b
modulus
m
Input:
1if
a
≡
b
mod
m
,
0
otherwise
Return:
if (a.mequ (b, m)) //
...
Example: