};
+
+/**
+ * Convert a short hash to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param hc the short hash code
+ * @return string form; will be overwritten by next call to GNUNET_h2s.
+ */
+const char *
+GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc)
+{
+ static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret;
+
+ GNUNET_CRYPTO_short_hash_to_enc (hc, &ret);
+ return (const char *) &ret;
+}
+
+
/**
* Calculate how many bytes we will need to serialize the given
* records.
size_t data_size)
{
char tmp[INET6_ADDRSTRLEN];
+ struct GNUNET_CRYPTO_ShortHashAsciiEncoded enc;
switch (type)
{
return NULL;
return GNUNET_strdup (tmp);
case GNUNET_NAMESTORE_TYPE_PKEY:
- if (data_size != sizeof (GNUNET_HashCode))
+ if (data_size != sizeof (struct GNUNET_ShortHashCode))
return NULL;
- return GNUNET_strdup (GNUNET_h2s_full (data));
+ GNUNET_CRYPTO_short_hash_to_enc (data,
+ &enc);
+ return GNUNET_strdup (enc.short_encoding);
case GNUNET_NAMESTORE_TYPE_PSEU:
return GNUNET_strndup (data, data_size);
default:
return GNUNET_SYSERR;
*data = GNUNET_malloc (sizeof (GNUNET_HashCode));
memcpy (*data, &pkey, sizeof (pkey));
+ *data_size = sizeof (GNUNET_HashCode);
return GNUNET_OK;
case GNUNET_NAMESTORE_TYPE_PSEU:
*data = GNUNET_strdup (s);