aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-12 05:57:42 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-12 05:57:42 +0000
commitcf6eef99e7f9d0bccc1691fa9792ea72e15be8cc (patch)
tree09341598d1da025e67c5374bcc8deba099851227 /src
parentff1381d015fc36cce9d840751d48426cac3ea78f (diff)
downloadgnunet-cf6eef99e7f9d0bccc1691fa9792ea72e15be8cc.tar.gz
gnunet-cf6eef99e7f9d0bccc1691fa9792ea72e15be8cc.zip
fix
Diffstat (limited to 'src')
-rw-r--r--src/util/crypto_ksk.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/util/crypto_ksk.c b/src/util/crypto_ksk.c
index 5a7069d74..fd5392840 100644
--- a/src/util/crypto_ksk.c
+++ b/src/util/crypto_ksk.c
@@ -162,19 +162,6 @@ static int no_of_small_prime_numbers = DIM (small_prime_numbers) - 1;
162 return mpz_sizeinbase (a, 2); 162 return mpz_sizeinbase (a, 2);
163} 163}
164 164
165/**
166 * Count the number of zerobits at the low end of A
167 */
168static unsigned int
169get_trailing_zeros (mpz_t a)
170{
171 unsigned int count = 0;
172 unsigned int nbits = get_nbits (a);
173
174 while ((mpz_tstbit (a, count)) && (count < nbits))
175 count++;
176 return count;
177}
178 165
179/** 166/**
180 * Set bit N of A. and clear all bits above 167 * Set bit N of A. and clear all bits above
@@ -240,7 +227,7 @@ is_prime (mpz_t n, int steps, GNUNET_HashCode * hc)
240 227
241 /* Find q and k, so that n = 1 + 2^k * q . */ 228 /* Find q and k, so that n = 1 + 2^k * q . */
242 mpz_init_set (q, nminus1); 229 mpz_init_set (q, nminus1);
243 k = get_trailing_zeros (q); 230 k = mpz_scan0 (q, 0);
244 mpz_tdiv_q_2exp (q, q, k); 231 mpz_tdiv_q_2exp (q, q, k);
245 232
246 for (i = 0; i < steps; i++) 233 for (i = 0; i < steps; i++)