Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * mpprime.h |
michael@0 | 3 | * |
michael@0 | 4 | * Utilities for finding and working with prime and pseudo-prime |
michael@0 | 5 | * integers |
michael@0 | 6 | * |
michael@0 | 7 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 8 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 9 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 10 | |
michael@0 | 11 | #ifndef _H_MP_PRIME_ |
michael@0 | 12 | #define _H_MP_PRIME_ |
michael@0 | 13 | |
michael@0 | 14 | #include "mpi.h" |
michael@0 | 15 | |
michael@0 | 16 | extern const int prime_tab_size; /* number of primes available */ |
michael@0 | 17 | extern const mp_digit prime_tab[]; |
michael@0 | 18 | |
michael@0 | 19 | /* Tests for divisibility */ |
michael@0 | 20 | mp_err mpp_divis(mp_int *a, mp_int *b); |
michael@0 | 21 | mp_err mpp_divis_d(mp_int *a, mp_digit d); |
michael@0 | 22 | |
michael@0 | 23 | /* Random selection */ |
michael@0 | 24 | mp_err mpp_random(mp_int *a); |
michael@0 | 25 | mp_err mpp_random_size(mp_int *a, mp_size prec); |
michael@0 | 26 | |
michael@0 | 27 | /* Pseudo-primality testing */ |
michael@0 | 28 | mp_err mpp_divis_vector(mp_int *a, const mp_digit *vec, int size, int *which); |
michael@0 | 29 | mp_err mpp_divis_primes(mp_int *a, mp_digit *np); |
michael@0 | 30 | mp_err mpp_fermat(mp_int *a, mp_digit w); |
michael@0 | 31 | mp_err mpp_fermat_list(mp_int *a, const mp_digit *primes, mp_size nPrimes); |
michael@0 | 32 | mp_err mpp_pprime(mp_int *a, int nt); |
michael@0 | 33 | mp_err mpp_sieve(mp_int *trial, const mp_digit *primes, mp_size nPrimes, |
michael@0 | 34 | unsigned char *sieve, mp_size nSieve); |
michael@0 | 35 | mp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong, |
michael@0 | 36 | unsigned long * nTries); |
michael@0 | 37 | |
michael@0 | 38 | #endif /* end _H_MP_PRIME_ */ |