1 | /* |
2 | Name: iprime.h |
3 | Purpose: Pseudoprimality testing routines |
4 | Author: M. J. Fromberger |
5 | |
6 | Copyright (C) 2002-2008 Michael J. Fromberger, All Rights Reserved. |
7 | |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | of this software and associated documentation files (the "Software"), to deal |
10 | in the Software without restriction, including without limitation the rights |
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | copies of the Software, and to permit persons to whom the Software is |
13 | furnished to do so, subject to the following conditions: |
14 | |
15 | The above copyright notice and this permission notice shall be included in |
16 | all copies or substantial portions of the Software. |
17 | |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24 | SOFTWARE. |
25 | */ |
26 | |
27 | #ifndef IPRIME_H_ |
28 | #define IPRIME_H_ |
29 | |
30 | #include "imath.h" |
31 | |
32 | #ifdef __cplusplus |
33 | extern "C" { |
34 | #endif |
35 | |
36 | /* Reports whether z is likely to be prime, meaning z >= 2 and has no positive |
37 | divisors 1 < d < z. It returns MP_YES if z is probably prime, or MP_NO if z |
38 | is definitely not prime. |
39 | */ |
40 | mp_result mp_int_is_prime(mp_int z); |
41 | |
42 | /* Find the first apparent prime in ascending order from z */ |
43 | mp_result mp_int_find_prime(mp_int z); |
44 | |
45 | #ifdef __cplusplus |
46 | } |
47 | #endif |
48 | #endif /* IPRIME_H_ */ |
49 | |