Cryptography Reference
In-Depth Information
calculation of the square root of a
LINT
object
modulo a prime product
p
Function:
·
q
Syntax:
LINT
LINT::root (const LINT& p, const LINT& q);
implicit argument
a
prime modulus
p
>
2
, prime modulus
q
>
2
Input:
square root of
a
if
a
is a quadratic residue modulo
pq
otherwise 0 (
Get_Warning_Status() == E_LINT_ERR
indicates that
a
is not a quadratic residue modulo
p*q
)
Return:
c = a.root (p, q);
Example:
test of whether a
LINT
object is a square
Function:
int
LINT::issqr(void);
,
Syntax:
test candidate
a
as implicit argument
Input:
Return:
square root of
a
if
a
is a square
otherwise 0 if
a==0
or
a
not a square
if(0 == (r = a.issqr ())) //
...
Example:
probabilistic primality test of a
LINT
object
Function:
int
LINT::isprime (int nsp, int rnds);
Syntax:
test candidate
p
as implicit argument
nsp
(number of primes for the division test;
default is 302)
rnds
(number of passes through test;
default is zero for automatic optimization
via the function
prime_l()
)
Input:
1if
p
is a “probable” prime
0 otherwise
Return:
if(p.isprime ()) //
...
Example: