Cryptography Reference
In-Depth Information
Word position
s
i
and bit position
d
i
of the digit
e
i
in the variables
word
and
bit
.
word = fk >> LDBITPERDGT;
/* fk div 16 */
bit = fk & (BITPERDGT - 1U);
/* fk mod 16 */
Computation of the digit
e
i
with the formula derived above;
e
i
is represented by
the variable
digit
.
switch (k)
{
case 1:
case 2:
case 4:
case 8:
digit = ((ULONG)(e_l[word + 1] ) >> bit) & k_mask;
break;
default:
digit = ((ULONG)(e_l[word + 1] | ((ULONG)e_l[word + 2]
<< BITPERDGT)) >> bit) & k_mask;
}
Step 3 of the algorithm, the case
digit
=
e
i
=0
;
t
is set via the table
twotab
[
e
i
]
to
the two-part of
e
i
.
if (digit != 0)
/* k-digit>0*/
{
t = twotab[digit];
Calculation of
p
2
k
−
t
a
u
in
acc_l
. Access to
a
u
with the odd part
u
of
e
i
is via
aptr_l
[
oddtab
[
e
i
]]
.
for(s=k-t;s>0;s--)
{
msqr_l (acc_l, acc_l, m_l);
}
mmul_l (acc_l, aptr_l[oddtab[digit]], acc_l, m_l);