From 18a2fae3b594f7ef54104b708d00641f6ed5de1e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 18 Sep 2022 17:36:35 +0200 Subject: add new signature functions for DD31 --- src/util/util.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/util/util.c') diff --git a/src/util/util.c b/src/util/util.c index 2d10fd69..f715456d 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, -- cgit v1.2.3