Change header file guard names.
[u/mdw/catacomb] / pgen.h
diff --git a/pgen.h b/pgen.h
index 536ba0a..6d180c3 100644 (file)
--- 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.3 1999/12/10 23:29:48 mdw Exp $
  *
  * Finding and testing prime numbers
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: pgen.h,v $
+ * Revision 1.3  1999/12/10 23:29:48  mdw
+ * Change header file guard names.
+ *
+ * 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.
  *
  */
 
-#ifndef PGEN_H
-#define PGEN_H
+#ifndef CATACOMB_PGEN_H
+#define CATACOMB_PGEN_H
 
 #ifdef __cplusplus
   extern "C" {
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifndef MP_H
+#ifndef CATACOMB_MP_H
 #  include "mp.h"
 #endif
 
-#ifndef PTAB_H
+#ifndef CATACOMB_PTAB_H
 #  include "ptab.h"
 #endif
 
@@ -108,6 +114,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