Research Article

A Vendor-Neutral Unified Core for Cryptographic Operations in GF(p) and GF() Based on Montgomery Arithmetic

Algorithm 2

Modified Miller-Rabin Primality Test.
Precomputation: (, with )
Input: (, , ,   )
Output: (, composite or probably prime)
;
;
for     from 1 to    do
;
;
;
if  orthen
continue;
for   fromtodo
;
;
if    then
return ( composite);
;
if    then
continue;
return ( composite);
return ( probably prime)