projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f53e991
)
fixes
author
Christian Grothoff
<christian@grothoff.org>
Sat, 23 Jul 2011 14:19:09 +0000
(14:19 +0000)
committer
Christian Grothoff
<christian@grothoff.org>
Sat, 23 Jul 2011 14:19:09 +0000
(14:19 +0000)
src/nse/gnunet-service-nse.c
patch
|
blob
|
history
diff --git
a/src/nse/gnunet-service-nse.c
b/src/nse/gnunet-service-nse.c
index 6128300ddcd105e88855872a7947e4ddaa6232cc..2d323a36af62a092cc5040c6aa7b3bf47f426779 100644
(file)
--- a/
src/nse/gnunet-service-nse.c
+++ b/
src/nse/gnunet-service-nse.c
@@
-643,20
+643,20
@@
update_flood_message(void *cls,
/**
/**
- * Count the
trail
ing zeroes in hash.
+ * Count the
lead
ing zeroes in hash.
*
* @param hash
*
* @param hash
- * @return the number of
trail
ing zero bits.
+ * @return the number of
lead
ing zero bits.
*/
static unsigned int
*/
static unsigned int
-count_
trail
ing_zeroes(const GNUNET_HashCode *hash)
+count_
lead
ing_zeroes(const GNUNET_HashCode *hash)
{
unsigned int hash_count;
{
unsigned int hash_count;
- hash_count =
sizeof(GNUNET_HashCode) * 8
;
+ hash_count =
0
;
while ((0 == GNUNET_CRYPTO_hash_get_bit(hash, hash_count)))
while ((0 == GNUNET_CRYPTO_hash_get_bit(hash, hash_count)))
- hash_count
--
;
- return
(sizeof(GNUNET_HashCode) * 8) -
hash_count;
+ hash_count
++
;
+ return hash_count;
}
}
@@
-683,13
+683,13
@@
check_proof_of_work(const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pkey,
pkey,
sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
GNUNET_CRYPTO_hash (buf, sizeof (buf), &result);
pkey,
sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
GNUNET_CRYPTO_hash (buf, sizeof (buf), &result);
- return (count_
trail
ing_zeroes (&result) >= NSE_WORK_REQUIRED) ? GNUNET_YES : GNUNET_NO;
+ return (count_
lead
ing_zeroes (&result) >= NSE_WORK_REQUIRED) ? GNUNET_YES : GNUNET_NO;
}
/**
* Given a public key, find an integer such that the hash of the key
}
/**
* Given a public key, find an integer such that the hash of the key
- * concatenated with the integer has NSE_WORK_REQUIRED
trail
ing 0
+ * concatenated with the integer has NSE_WORK_REQUIRED
lead
ing 0
* bits. FIXME: this is a synchronous function... bad
*
* @param pkey the public key
* bits. FIXME: this is a synchronous function... bad
*
* @param pkey the public key
@@
-712,7
+712,7
@@
find_proof_of_work(const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pkey)
&counter,
sizeof(uint64_t));
GNUNET_CRYPTO_hash (buf, sizeof (buf), &result);
&counter,
sizeof(uint64_t));
GNUNET_CRYPTO_hash (buf, sizeof (buf), &result);
- if (NSE_WORK_REQUIRED <= count_
trail
ing_zeroes(&result))
+ if (NSE_WORK_REQUIRED <= count_
lead
ing_zeroes(&result))
break;
counter++;
}
break;
counter++;
}
@@
-1131,7
+1131,7
@@
int
main(int argc, char * const *argv)
{
return (GNUNET_OK == GNUNET_SERVICE_run (argc, argv,
main(int argc, char * const *argv)
{
return (GNUNET_OK == GNUNET_SERVICE_run (argc, argv,
- "
gnunet-service-
nse",
+ "nse",
GNUNET_SERVICE_OPTION_NONE, &run,
NULL)) ? 0 : 1;
}
GNUNET_SERVICE_OPTION_NONE, &run,
NULL)) ? 0 : 1;
}