Added SILC Thread Queue API
[silc.git] / lib / silcmath / silcmath.h
1 /*
2
3   silcmath.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 1997 - 2007 Pekka Riikonen
8
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; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 /****h* silcmath/SILC Math Interface
21  *
22  * DESCRIPTION
23  *
24  * SILC Math interface includes various utility functions such as
25  * prime generation, and conversion routines. See the silcmp.h for the
26  * SILC MP interface.
27  *
28  ***/
29
30 #ifndef SILCMATH_H
31 #define SILCMATH_H
32
33 #include "silcrng.h"
34
35 /****f* silcmath/SilcMathAPI/silc_math_gen_prime
36  *
37  * SYNOPSIS
38  *
39  *    SilcBool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits,
40  *                                 SilcBool verbose, SilcRng rng);
41  *
42  * DESCRIPTION
43  *
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.
47  *
48  *    If argument verbose is TRUE this will display some status information
49  *    about the progress of generation.  If the `rng' is NULL then global
50  *    RNG is used, if non-NULL then `rng' is used to generate the random
51  *    number number.
52  *
53  ***/
54 SilcBool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits,
55                              SilcBool verbose, SilcRng rng);
56
57 /****f* silcmath/SilcMathAPI/silc_math_prime_test
58  *
59  * SYNOPSIS
60  *
61  *    int silc_math_prime_test(SilcMPInt *p);
62  *
63  * DESCRIPTION
64  *
65  *    Performs primality testings for given number. Returns TRUE if the
66  *    number is probably a prime.
67  *
68  ***/
69 SilcBool silc_math_prime_test(SilcMPInt *p);
70
71 #endif