Next: , Up: Prime numbers   [Contents][Index]

13.1 Generation

Function: gcry_error_t gcry_prime_generate (gcry_mpi_t *prime,unsigned int prime_bits, unsigned int factor_bits, gcry_mpi_t **factors, gcry_prime_check_func_t cb_func, void *cb_arg, gcry_random_level_t random_level, unsigned int flags)

Generate a new prime number of prime_bits bits and store it in prime. If factor_bits is non-zero, one of the prime factors of (prime - 1) / 2 must be factor_bits bits long. If factors is non-zero, allocate a new, NULL-terminated array holding the prime factors and store it in factors. flags might be used to influence the prime number generation process.

Function: gcry_error_t gcry_prime_group_generator (gcry_mpi_t *r_g, gcry_mpi_t prime, gcry_mpi_t *factors, gcry_mpi_t start_g)

Find a generator for prime where the factorization of (prime - 1) is in the NULL terminated array factors. Return the generator as a newly allocated MPI in r_g. If start_g is not NULL, use this as the start for the search.

Function: void gcry_prime_release_factors (gcry_mpi_t *factors)

Convenience function to release the factors array.