diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-01-02 13:10:25 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-01-02 13:10:25 +0100 |
commit | bb686c48354853aa725e493e85edce0602ed85e2 (patch) | |
tree | 6b0aeea58a7aebe0e3108da5302eaeae2c996ceb /src/revocation | |
parent | 2cbb614f694701c4afdab88f58ef7626629e1bc3 (diff) | |
download | gnunet-bb686c48354853aa725e493e85edce0602ed85e2.tar.gz gnunet-bb686c48354853aa725e493e85edce0602ed85e2.zip |
revise DHT hashing functions, add test logic
Diffstat (limited to 'src/revocation')
-rw-r--r-- | src/revocation/revocation_api.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index f2b95bafa..1032b98f7 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -389,23 +389,6 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) | |||
389 | 389 | ||
390 | 390 | ||
391 | /** | 391 | /** |
392 | * Count the leading zeroes in hash. | ||
393 | * | ||
394 | * @param hash to count leading zeros in | ||
395 | * @return the number of leading zero bits. | ||
396 | */ | ||
397 | static unsigned int | ||
398 | count_leading_zeroes (const struct GNUNET_HashCode *hash) | ||
399 | { | ||
400 | unsigned int hash_count; | ||
401 | hash_count = 0; | ||
402 | while ((0 == GNUNET_CRYPTO_hash_get_bit_ltr (hash, hash_count))) | ||
403 | hash_count++; | ||
404 | return hash_count; | ||
405 | } | ||
406 | |||
407 | |||
408 | /** | ||
409 | * Calculate the average zeros in the pows. | 392 | * Calculate the average zeros in the pows. |
410 | * | 393 | * |
411 | * @param ph the PowHandle | 394 | * @param ph the PowHandle |
@@ -535,7 +518,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
535 | buf, | 518 | buf, |
536 | sizeof(buf), | 519 | sizeof(buf), |
537 | &result); | 520 | &result); |
538 | tmp_score = count_leading_zeroes (&result); | 521 | tmp_score = GNUNET_CRYPTO_hash_count_leading_zeroes (&result); |
539 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 522 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
540 | "Score %u with %" PRIu64 " (#%u)\n", | 523 | "Score %u with %" PRIu64 " (#%u)\n", |
541 | tmp_score, pow_val, i); | 524 | tmp_score, pow_val, i); |