Cryptography Reference
In-Depth Information
Calculation of
p
2
t
;
p
is still represented by
acc_l
.
for(;t>0;t--)
{
msqr_l (acc_l, acc_l, m_l);
}
}
else
/* k-digit == 0 */
{
Step 3 of the algorithm, case
e
i
=0
: Calculate
p
2
k
.
for(s=k;s>0;s--)
{
msqr_l (acc_l, acc_l, m_l);
}
}
}
End of the loop; output of
acc_l
as power residue modulo
m_l
.
cpy_l (p_l, acc_l);
At the end, allocated memory is released.
free (aptr_l);
if (ptr_l != NULL)
free (ptr_l);
return E_CLINT_OK;
}
The various processes of
M
-ary exponentiation can be clarified with the help
of a numerical example. To this end let us examine the calculation of the power
1234
667
mod 18577
, which will be carried out by the function
mexpk_l()
in the
following steps: