5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2001 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
21 /****h* silcmath/SILC Math Interface
25 * SILC Math interface includes various utility functions such as
26 * prime generation, and conversion routines. See the silcmp.h for the
36 /****f* silcmath/SilcMathAPI/silc_math_gen_prime
40 * int silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, bool verbose);
44 * Find appropriate prime. It generates a number by taking random bytes.
45 * It then tests the number that it's not divisible by any of the small
46 * primes and then it performs Fermat's prime test. I thank Rieks Joosten
47 * (r.joosten@pijnenburg.nl) for such a good help with prime tests.
49 * If argument verbose is TRUE this will display some status information
50 * about the progress of generation. If the `rng' is NULL then global
51 * RNG is used, if non-NULL then `rng' is used to generate the random
55 bool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, bool verbose,
58 /****f* silcmath/SilcMathAPI/silc_math_prime_test
62 * int silc_math_prime_test(SilcMPInt *p);
66 * Performs primality testings for given number. Returns TRUE if the
67 * number is probably a prime.
70 bool silc_math_prime_test(SilcMPInt *p);