X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/9a8b0c8d33c593353185871b581bc8f5be8600fb..7d5a856ef5b3f27ffa8a5c0765f6677313e90ab4:/pfilt.h diff --git a/pfilt.h b/pfilt.h index e3461d2..24f94c7 100644 --- a/pfilt.h +++ b/pfilt.h @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: pfilt.h,v 1.1 1999/12/22 15:49:39 mdw Exp $ + * $Id: pfilt.h,v 1.4 2004/04/08 01:36:15 mdw Exp $ * * Finding and testing prime numbers * * (c) 1999 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,35 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: pfilt.h,v $ - * Revision 1.1 1999/12/22 15:49:39 mdw - * Renamed from `pgen'. Reworking for new prime-search system. - * - * 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 CATACOMB_PFILT_H #define CATACOMB_PFILT_H @@ -57,7 +40,7 @@ # include "mp.h" #endif -#ifndef CATACOMB_PTAB_H +#ifndef CATACOMB_PRIMETAB_H # include "primetab.h" #endif @@ -65,11 +48,24 @@ typedef struct pfilt { mp *m; - unsigned char r[NPRIME]; + smallprime r[NPRIME]; } pfilt; /*----- Functions provided ------------------------------------------------*/ +/* --- @pfilt_smallfactor@ --- * + * + * Arguments: @mp *m@ = integer to test + * + * Returns: One of the @PGEN@ result codes. + * + * Use: Tests a number by dividing by a number of small primes. This + * is a useful first step if you're testing random primes; for + * sequential searches, @pfilt_create@ works better. + */ + +extern int pfilt_smallfactor(mp */*m*/); + /* --- @pfilt_create@ --- * * * Arguments: @pfilt *p@ = pointer to prime filtering context