X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/581c854ebf69254c5ae527a789994a0fc70368e7..9f11b970d10c4139e1bfd0be6e817e2dfe982f41:/pgen.h diff --git a/pgen.h b/pgen.h index 9ce4e86..1277b3d 100644 --- a/pgen.h +++ b/pgen.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: pgen.h,v 1.4 1999/12/22 16:01:11 mdw Exp $ + * $Id: pgen.h,v 1.6 2000/06/17 11:52:12 mdw Exp $ * * Prime generation glue * @@ -30,6 +30,12 @@ /*----- Revision history --------------------------------------------------* * * $Log: pgen.h,v $ + * Revision 1.6 2000/06/17 11:52:12 mdw + * Add the GCD filter. + * + * Revision 1.5 2000/02/12 18:21:03 mdw + * Overhaul of key management (again). + * * Revision 1.4 1999/12/22 16:01:11 mdw * Same file, completely different code. Main interface for new prime- * search system. @@ -191,6 +197,19 @@ typedef struct pgen_safestepctx { extern int pgen_safestep(int /*rq*/, pgen_event */*ev*/, void */*p*/); +/* --- @pgen_safejump@ --- * + * + * Jumps two numbers, %$q$% and %$p = 2q + 1$% such that neither has any + * small factors. + */ + +typedef struct pgen_safejumpctx { + pfilt q, jq; + pfilt p, jp; +} pgen_safejumpctx; + +extern int pgen_safejump(int /*rq*/, pgen_event */*ev*/, void */*p*/); + /* --- @pgen_safetest@ --- * * * Applies Rabin-Miller tests to %$p$% and %$(p - 1)/2$%. @@ -203,6 +222,24 @@ typedef struct pgen_safetestctx { extern int pgen_safetest(int /*rq*/, pgen_event */*ev*/, void */*p*/); +/*----- Miscellaneous steppers and testers --------------------------------*/ + +typedef struct pgen_gcdstepctx { + pfilt p, jp; /* Prime filter and step filter */ + mp *q, *jq; /* %$p - 1$%, and a step value*/ + mp *r; /* Other argument for GCD */ + mp *g; /* GCD output (must be inited) */ + mp *max; /* Maximum permissible GCD */ +} pgen_gcdstepctx; + +/* --- @pgen_gcdstep@ --- * + * + * Steps @p@ and @q@, until @p@ has no small factors, and + * %$\gcd(p, r) \le max$%. + */ + +extern int pgen_gcdstep(int /*rq*/, pgen_event */*ev*/, void */*p*/); + /*----- Standard event handlers -------------------------------------------*/ /* --- @pgen_evspin@ --- *