|
|
1.1.1.2 ! root 1: /* genprime.h - C include file for generation of large primes ! 2: used by public-key key generation routines. ! 3: ! 4: (c) Copyright 1987 by Philip Zimmermann. All rights reserved. ! 5: The author assumes no liability for damages resulting from the use ! 6: of this software, even if the damage results from defects in this ! 7: software. No warranty is expressed or implied. ! 8: ! 9: These functions are for the generation of large prime integers and ! 10: for other functions related to factoring and key generation for ! 11: many number-theoretic cryptographic algorithms, such as the NIST ! 12: Digital Signature Standard. ! 13: ! 14: NOTE: This assumes previous inclusion of "mpilib.h" ! 15: */ ! 16: ! 17: extern word16 primetable[]; /* table of small primes, zero-terminated.*/ ! 18: ! 19: boolean primetest(unitptr p); ! 20: /* Returns TRUE iff p is a prime. */ ! 21: ! 22: int nextprime(unitptr p); ! 23: /* Find next higher prime starting at p, returning result in p. */ ! 24: ! 25: void randombits(unitptr p,short nbits); ! 26: /* Make a random unit array p with nbits of precision. */ ! 27: ! 28: int randomprime(unitptr p,short nbits); ! 29: /* Makes a "random" prime p with nbits significant bits of precision. */ ! 30: ! 31: void mp_gcd(unitptr result,unitptr a,unitptr n); ! 32: /* Computes greatest common divisor via Euclid's algorithm. */ ! 33: ! 34: void mp_inv(unitptr x,unitptr a,unitptr n); ! 35: /* Euclid's algorithm extended to compute multiplicative inverse. ! 36: Computes x such that a*x mod n = 1, where 0<a<n */ ! 37: ! 38: int mp_sqrt(unitptr quotient,unitptr dividend); ! 39: /* Quotient is returned as the square root of dividend. */ ! 40: ! 41:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.