summaryrefslogtreecommitdiff
path: root/src/util/gnunet-scrypt.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-11-30 22:43:08 +0100
committerChristian Grothoff <christian@grothoff.org>2019-11-30 22:43:19 +0100
commitea544ab2cae7f4f969a705d33d10da1a004cbd70 (patch)
treeaa4cc29c9831b5bfa9221ed2740b46e6f79e8841 /src/util/gnunet-scrypt.c
parentd817f861e6da2da5759a4b55117a8d8d47a91a87 (diff)
create crypto_pow, in preparation for #3795
Diffstat (limited to 'src/util/gnunet-scrypt.c')
-rw-r--r--src/util/gnunet-scrypt.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c
index 8d8451950..d84f486a7 100644
--- a/src/util/gnunet-scrypt.c
+++ b/src/util/gnunet-scrypt.c
@@ -68,29 +68,6 @@ shutdown_task (void *cls)
/**
- * Calculate the 'proof-of-work' hash (an expensive hash).
- *
- * @param buf data to hash
- * @param buf_len number of bytes in @a buf
- * @param result where to write the resulting hash
- */
-static void
-pow_hash (const void *buf, size_t buf_len, struct GNUNET_HashCode *result)
-{
- GNUNET_break (
- 0 == gcry_kdf_derive (buf,
- buf_len,
- GCRY_KDF_SCRYPT,
- 1 /* subalgo */,
- "gnunet-proof-of-work",
- strlen ("gnunet-proof-of-work"),
- 2 /* iterations; keep cost of individual op small */,
- sizeof(struct GNUNET_HashCode),
- result));
-}
-
-
-/**
* Count the leading zeroes in hash.
*
* @param hash to count leading zeros in
@@ -140,7 +117,7 @@ find_proof (void *cls)
while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
{
GNUNET_memcpy (buf, &counter, sizeof(uint64_t));
- pow_hash (buf, sizeof(buf), &result);
+ GNUNET_CRYPTO_pow_hash (buf, sizeof(buf), &result);
if (nse_work_required <= count_leading_zeroes (&result))
{
proof = counter;