bugfix
[oweals/gnunet.git] / src / util / common_logging.c
index c77464eb54bdb028289cedf08e339ec25ffad380..a1a60b800bd23395871cc96215217ee6e16a6a32 100644 (file)
@@ -380,6 +380,24 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind)
 }
 
 
+/**
+ * Convert a 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 pid the peer identity
+ * @return string form; will be overwritten by next call to GNUNET_h2s.
+ */
+const char *
+GNUNET_h2s (const GNUNET_HashCode *pid)
+{
+  static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
+  GNUNET_CRYPTO_hash_to_enc (pid, &ret);
+  ret.encoding[8] = '\0';
+  return (const char *) ret.encoding;
+}
+
+
 /**
  * Convert a peer identity to a string (for printing debug messages).
  * This is one of the very few calls in the entire API that is