Category : C Source Code
Archive   : PGP20SRC.ZIP
Filename : GENPRIME.H

Output of file : GENPRIME.H contained in archive : PGP20SRC.ZIP
/* genprime.h - C include file for generation of large primes
used by public-key key generation routines.

(c) Copyright 1987 by Philip Zimmermann. All rights reserved.
The author assumes no liability for damages resulting from the use
of this software, even if the damage results from defects in this
software. No warranty is expressed or implied.

These functions are for the generation of large prime integers and
for other functions related to factoring and key generation for
many number-theoretic cryptographic algorithms, such as the NIST
Digital Signature Standard.

NOTE: This assumes previous inclusion of "mpilib.h"

extern word16 primetable[]; /* table of small primes, zero-terminated.*/

boolean primetest(unitptr p);
/* Returns TRUE iff p is a prime. */

int nextprime(unitptr p);
/* Find next higher prime starting at p, returning result in p. */

void randombits(unitptr p,short nbits);
/* Make a random unit array p with nbits of precision. */

int randomprime(unitptr p,short nbits);
/* Makes a "random" prime p with nbits significant bits of precision. */

void mp_gcd(unitptr result,unitptr a,unitptr n);
/* Computes greatest common divisor via Euclid's algorithm. */

void mp_inv(unitptr x,unitptr a,unitptr n);
/* Euclid's algorithm extended to compute multiplicative inverse.
Computes x such that a*x mod n = 1, where 0
int mp_sqrt(unitptr quotient,unitptr dividend);
/* Quotient is returned as the square root of dividend. */

  3 Responses to “Category : C Source Code
Archive   : PGP20SRC.ZIP
Filename : GENPRIME.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: