updates.
[silc.git] / lib / silcmath / silcmath.h
1 /****h* silcmath/silcmath.h
2  *
3  * NAME
4  *
5  * silcmath.h
6  *
7  * COPYRIGHT
8  *
9  * Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
10  *
11  * Copyright (C) 1997 - 2000 Pekka Riikonen
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * DESCRIPTION
24  *
25  * SILC Math interface includes various utility functions such as
26  * prime generation, and conversion routines. See the silcmp.h for the
27  * SILC MP interface.
28  *
29  */
30
31 #ifndef SILCMATH_H
32 #define SILCMATH_H
33
34 /****f* silcmath/SilcMathAPI/silc_math_gen_prime
35  *
36  * SYNOPSIS
37  *
38  *    int silc_math_gen_prime(SilcInt *prime, uint32 bits, int verbose);
39  *
40  * DESCRIPTION
41  *
42  *    Find appropriate prime. It generates a number by taking random bytes. 
43  *    It then tests the number that it's not divisible by any of the small 
44  *    primes and then it performs Fermat's prime test. I thank Rieks Joosten 
45  *    (r.joosten@pijnenburg.nl) for such a good help with prime tests. 
46  *
47  *    If argument verbose is TRUE this will display some status information
48  *    about the progress of generation.
49  *
50  ***/
51 int silc_math_gen_prime(SilcInt *prime, uint32 bits, int verbose);
52
53 /****f* silcmath/SilcMathAPI/silc_math_prime_test
54  *
55  * SYNOPSIS
56  *
57  *    int silc_math_prime_test(SilcInt *p);
58  *
59  * DESCRIPTION
60  *
61  *    Performs primality testings for given number. Returns TRUE if the 
62  *    number is probably a prime.
63  *
64  ***/
65 int silc_math_prime_test(SilcInt *p);
66
67 #endif