Cryptography Reference
In-Depth Information
int
twofact_l (CLINT a_l, CLINT b_l)
{
int k = 0;
if (EQZ_L (a_l))
{
SETZERO_L (b_l);
return 0;
}
cpy_l (b_l, a_l);
while (ISEVEN_L (b_l))
{
shr_l (b_l);
++k;
}
return k;
}
Thus equipped we can now create an efficient function
jacobi_l()
for
calculating the Jacobi symbol.
calculate the Jacobi symbol of two
CLINT
objects
Function:
int jacobi_l (CLINT aa_l, CLINT bb_l);
Syntax:
aa_l, bb_l
(operands)
Input:
±
1
(value of the Jacobi symbol of
aa_l
over
bb_l
)
Return:
static int tab2[] = 0, 1, 0, -1, 0, -1, 0, 1;
int
jacobi_l (CLINT aa_l, CLINT bb_l)
{
CLINT a_l, b_l, tmp_l;
long int k, v;
Step 1: The case
bb_l
=0.
if (EQZ_L (bb_l))
{
if (equ_l (aa_l, one_l))
{