version 1.5, 2003/12/22 09:16:57 |
version 1.6, 2004/04/22 11:56:57 |
|
|
#define QTYPE_UNSTRUCTURED (1) |
#define QTYPE_UNSTRUCTURED (1) |
#define QTYPE_SAFE (2) |
#define QTYPE_SAFE (2) |
#define QTYPE_SCHNOOR (3) |
#define QTYPE_SCHNOOR (3) |
#define QTYPE_SOPHIE_GERMAINE (4) |
#define QTYPE_SOPHIE_GERMAIN (4) |
#define QTYPE_STRONG (5) |
#define QTYPE_STRONG (5) |
|
|
/* Tests: decimal (bit field). |
/* Tests: decimal (bit field). |
|
|
} |
} |
|
|
/* |
/* |
* list candidates for Sophie-Germaine primes (where q = (p-1)/2) |
* list candidates for Sophie-Germain primes (where q = (p-1)/2) |
* to standard output. |
* to standard output. |
* The list is checked against small known primes (less than 2**30). |
* The list is checked against small known primes (less than 2**30). |
*/ |
*/ |
|
|
debug2("test q = largebase+%u", 2 * j); |
debug2("test q = largebase+%u", 2 * j); |
BN_set_word(q, 2 * j); |
BN_set_word(q, 2 * j); |
BN_add(q, q, largebase); |
BN_add(q, q, largebase); |
if (qfileout(out, QTYPE_SOPHIE_GERMAINE, QTEST_SIEVE, |
if (qfileout(out, QTYPE_SOPHIE_GERMAIN, QTEST_SIEVE, |
largetries, (power - 1) /* MSB */, (0), q) == -1) { |
largetries, (power - 1) /* MSB */, (0), q) == -1) { |
ret = -1; |
ret = -1; |
break; |
break; |
|
|
|
|
/* modulus (hex) */ |
/* modulus (hex) */ |
switch (in_type) { |
switch (in_type) { |
case QTYPE_SOPHIE_GERMAINE: |
case QTYPE_SOPHIE_GERMAIN: |
debug2("%10u: (%u) Sophie-Germaine", count_in, in_type); |
debug2("%10u: (%u) Sophie-Germain", count_in, in_type); |
a = q; |
a = q; |
BN_hex2bn(&a, cp); |
BN_hex2bn(&a, cp); |
/* p = 2*q + 1 */ |
/* p = 2*q + 1 */ |