aboutsummaryrefslogtreecommitdiff
path: root/src/util/gnunet-scrypt.c
diff options
context:
space:
mode:
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)
68 68
69 69
70/** 70/**
71 * Calculate the 'proof-of-work' hash (an expensive hash).
72 *
73 * @param buf data to hash
74 * @param buf_len number of bytes in @a buf
75 * @param result where to write the resulting hash
76 */
77static void
78pow_hash (const void *buf, size_t buf_len, struct GNUNET_HashCode *result)
79{
80 GNUNET_break (
81 0 == gcry_kdf_derive (buf,
82 buf_len,
83 GCRY_KDF_SCRYPT,
84 1 /* subalgo */,
85 "gnunet-proof-of-work",
86 strlen ("gnunet-proof-of-work"),
87 2 /* iterations; keep cost of individual op small */,
88 sizeof(struct GNUNET_HashCode),
89 result));
90}
91
92
93/**
94 * Count the leading zeroes in hash. 71 * Count the leading zeroes in hash.
95 * 72 *
96 * @param hash to count leading zeros in 73 * @param hash to count leading zeros in
@@ -140,7 +117,7 @@ find_proof (void *cls)
140 while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) 117 while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
141 { 118 {
142 GNUNET_memcpy (buf, &counter, sizeof(uint64_t)); 119 GNUNET_memcpy (buf, &counter, sizeof(uint64_t));
143 pow_hash (buf, sizeof(buf), &result); 120 GNUNET_CRYPTO_pow_hash (buf, sizeof(buf), &result);
144 if (nse_work_required <= count_leading_zeroes (&result)) 121 if (nse_work_required <= count_leading_zeroes (&result))
145 { 122 {
146 proof = counter; 123 proof = counter;