Cryptography Reference
In-Depth Information
instead of randomly selected bases. According to experience this in no way
impairs the results of the test.
We now introduce the division sieve. The function uses the division routine
for short divisors that we developed for the function div_l() .
Function:
division sieve
USHORT sieve_l (CLINT a_l, unsigned no_of_smallprimes);
Syntax:
a_l (candidate for primality search)
no_of_smallprimes (number of primes to serve as divisors, without 2)
Input:
Return:
prime factor, if one is found
1, if the candidate itself is prime
0, if no factor is found
USHORT
sieve_l (CLINT a_l, unsigned int no_of_smallprimes)
{
clint *aptr_l;
USHORT bv, rv, qv;
ULONG rhat;
unsigned inti=1;
For the sake of completeness we first test whether a_1 is a multiple of 2. If, in fact,
a_1 has the value 2 ,then 1 is returned, while if a_1 is greater than 2 andiseven,
then 2 is returned as a factor.
if (ISEVEN_L (a_l))
{
if (equ_l (a_l, two_l))
{
return 1;
}
else
{
return 2;
}
}
bv=2;
do
{
 
Search WWH ::




Custom Search