X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/a7557fb1d7c718587ced64effa42f8edd838faf8..bd98b2dfce11db0e8893a2974d5f8db58dd90fa1:/pgen.h diff --git a/pgen.h b/pgen.h index 536ba0a..6f2000c 100644 --- a/pgen.h +++ b/pgen.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: pgen.h,v 1.1 1999/11/19 13:17:57 mdw Exp $ + * $Id: pgen.h,v 1.2 1999/11/20 22:23:05 mdw Exp $ * * Finding and testing prime numbers * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: pgen.h,v $ + * Revision 1.2 1999/11/20 22:23:05 mdw + * Add multiply-and-add function for Diffie-Hellman safe prime generation. + * * Revision 1.1 1999/11/19 13:17:57 mdw * Prime number generator and tester. * @@ -108,6 +111,26 @@ extern void pgen_destroy(pgen */*p*/); extern int pgen_step(pgen */*p*/, mpw /*step*/); +/* --- @pgen_muladd@ --- * + * + * Arguments: @pgen *p@ = destination prime generation context + * @const pgen *q@ = source prime generation context + * @mpw m@ = number to multiply by + * @mpw a@ = number to add + * + * Returns: One of the @PGEN@ constants above. + * + * Use: Multiplies the number in a prime generation context by a + * small value and then adds a small value. The destination + * should either be uninitialized or the same as the source. + * + * Common things to do include multiplying by 2 and adding 0 to + * turn a prime into a jump for finding other primes with @q@ as + * a factor of @p - 1@, or multiplying by 2 and adding 1. + */ + +extern int pgen_muladd(pgen */*p*/, const pgen */*q*/, mpw /*m*/, mpw /*a*/); + /* --- @pgen_jump@ --- * * * Arguments: @pgen *p@ = pointer to prime generation context