summaryrefslogtreecommitdiff
path: root/src/util/util.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-09-18 17:36:35 +0200
committerChristian Grothoff <christian@grothoff.org>2022-09-18 17:36:35 +0200
commit18a2fae3b594f7ef54104b708d00641f6ed5de1e (patch)
treee70dff8fb8bab32838c5b6d1da04eb31abf6e46e /src/util/util.c
parentb4b857abeaa0447b8dd4626f303ce7cdb728f0b7 (diff)
downloadexchange-18a2fae3b594f7ef54104b708d00641f6ed5de1e.tar.gz
exchange-18a2fae3b594f7ef54104b708d00641f6ed5de1e.tar.bz2
exchange-18a2fae3b594f7ef54104b708d00641f6ed5de1e.zip
add new signature functions for DD31
Diffstat (limited to 'src/util/util.c')
-rw-r--r--src/util/util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c
index 2d10fd69d..f715456d8 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -217,6 +217,31 @@ TALER_denom_fee_check_currency (
}
+/**
+ * Hash normalized @a j JSON object or array and
+ * store the result in @a hc.
+ *
+ * @param j JSON to hash
+ * @param[out] hc where to write the hash
+ */
+void
+TALER_json_hash (const json_t *j,
+ struct GNUNET_HashCode *hc)
+{
+ char *cstr;
+ size_t clen;
+
+ cstr = json_dumps (j,
+ JSON_COMPACT | JSON_SORT_KEYS);
+ GNUNET_assert (NULL != cstr);
+ clen = strlen (cstr);
+ GNUNET_CRYPTO_hash (cstr,
+ clen,
+ hc);
+ free (cstr);
+}
+
+
#ifdef __APPLE__
char *
strchrnul (const char *s,