aboutsummaryrefslogtreecommitdiff
path: root/src/nse/perf_kdf.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-12-01 11:01:08 +0000
committerng0 <ng0@n0.is>2019-12-01 11:01:08 +0000
commit435596a7cb2e5b9adbb8de90f3f917a61d089a1b (patch)
treeece3dacd8808923f884807ca1b8ac93fa24cfad4 /src/nse/perf_kdf.c
parent2f599ebe8ffcd76cfc92ae9fef56f397592becb5 (diff)
parent56d7341763046244bce789f1355441345711958c (diff)
downloadgnunet-435596a7cb2e5b9adbb8de90f3f917a61d089a1b.tar.gz
gnunet-435596a7cb2e5b9adbb8de90f3f917a61d089a1b.zip
Merge branch 'master' of gnunet.org:gnunet
Diffstat (limited to 'src/nse/perf_kdf.c')
-rw-r--r--src/nse/perf_kdf.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/nse/perf_kdf.c b/src/nse/perf_kdf.c
index ec6dc7ff3..c5975aaf2 100644
--- a/src/nse/perf_kdf.c
+++ b/src/nse/perf_kdf.c
@@ -29,39 +29,18 @@
29#include <gauger.h> 29#include <gauger.h>
30 30
31 31
32/**
33 * Calculate the 'proof-of-work' hash (an expensive hash).
34 *
35 * @param buf data to hash
36 * @param buf_len number of bytes in 'buf'
37 * @param result where to write the resulting hash
38 */
39static void
40pow_hash (const void *buf,
41 size_t buf_len,
42 struct GNUNET_HashCode *result)
43{
44 GNUNET_break (0 ==
45 gcry_kdf_derive (buf, buf_len,
46 GCRY_KDF_SCRYPT,
47 1 /* subalgo */,
48 "gnunet-proof-of-work", strlen (
49 "gnunet-proof-of-work"),
50 2 /* iterations; keep cost of individual op small */,
51 sizeof(struct GNUNET_HashCode), result));
52}
53
54
55static void 32static void
56perfHash () 33perfHash ()
57{ 34{
58 struct GNUNET_HashCode hc; 35 struct GNUNET_HashCode hc;
59 unsigned int i;
60 char buf[64]; 36 char buf[64];
61 37
62 memset (buf, 1, sizeof(buf)); 38 memset (buf, 1, sizeof(buf));
63 for (i = 0; i < 1024; i++) 39 for (unsigned int i = 0; i < 1024; i++)
64 pow_hash (buf, sizeof(buf), &hc); 40 GNUNET_CRYPTO_pow_hash ("gnunet-proof-of-work",
41 buf,
42 sizeof(buf),
43 &hc);
65} 44}
66 45
67 46