Update fp_isprime_ex.c
removed failure due to trivial case where a is in primes
This commit is contained in:
parent
55863ae1d9
commit
771fe2354f
@ -53,6 +53,10 @@ int fp_isprime_ex(fp_int *a, int t)
|
|||||||
|
|
||||||
/* do trial division */
|
/* do trial division */
|
||||||
for (r = 0; r < 256; r++) {
|
for (r = 0; r < 256; r++) {
|
||||||
|
if (fp_cmp_d(a,primes[r])== FP_EQ) {
|
||||||
|
printf("a is in the table\n");
|
||||||
|
return FP_YES;
|
||||||
|
}
|
||||||
fp_mod_d(a, primes[r], &d);
|
fp_mod_d(a, primes[r], &d);
|
||||||
if (d == 0) {
|
if (d == 0) {
|
||||||
return FP_NO;
|
return FP_NO;
|
||||||
|
Loading…
Reference in New Issue
Block a user