1 /* LibTomMath, multiple-precision integer library -- Tom St Denis
3 * LibTomMath is library that provides for multiple-precision
4 * integer arithmetic as well as number theoretic functionality.
6 * The library is designed directly after the MPI library by
7 * Michael Fromberger but has been written from scratch with
8 * additional optimizations in place.
10 * The library is free for all purposes without any express
13 * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
17 /* determines if an integers is divisible by one of the first 256 primes or not
19 * sets result to 0 if not, 1 if yes
22 mp_prime_is_divisible (mp_int * a, int *result)
30 for (ix = 0; ix < PRIME_SIZE; ix++) {
31 /* is it equal to the prime? */
32 if (mp_cmp_d (a, __prime_tab[ix]) == MP_EQ) {
37 /* what is a mod __prime_tab[ix] */
38 if ((err = mp_mod_d (a, __prime_tab[ix], &res)) != MP_OKAY) {
42 /* is the residue zero? */