[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23888 - in gnunet/src: gns include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23888 - in gnunet/src: gns include util |
Date: |
Tue, 18 Sep 2012 15:53:39 +0200 |
Author: schanzen
Date: 2012-09-18 15:53:39 +0200 (Tue, 18 Sep 2012)
New Revision: 23888
Modified:
gnunet/src/gns/gnunet-service-gns.c
gnunet/src/include/gnunet_common.h
gnunet/src/include/gnunet_crypto_lib.h
gnunet/src/util/common_logging.c
Log:
-short hash output func
Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-09-18 13:38:44 UTC (rev 23887)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-09-18 13:53:39 UTC (rev 23888)
@@ -412,7 +412,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Records for name `%s' in zone %s too large to fit into DHT"),
name,
- GNUNET_h2s (&zhash) /* FIXME: write converter for short hash...
*/);
+ GNUNET_short_h2s (&zhash));
GNUNET_free(nrb);
zone_update_taskid = GNUNET_SCHEDULER_add_now (&update_zone_dht_next,
NULL);
Modified: gnunet/src/include/gnunet_common.h
===================================================================
--- gnunet/src/include/gnunet_common.h 2012-09-18 13:38:44 UTC (rev 23887)
+++ gnunet/src/include/gnunet_common.h 2012-09-18 13:53:39 UTC (rev 23888)
@@ -247,6 +247,16 @@
/**
+ * FIXME
+ * @brief 256-bit hashcode
+ **/
+struct GNUNET_CRYPTO_ShortHashCode
+{
+ uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */
+};
+
+
+/**
* The identity of the host (basically the SHA-512 hashcode of
* it's public key).
*/
@@ -438,6 +448,31 @@
/**
+ * Convert a short hash value 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
+ */
+const char *
+GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc);
+
+
+/**
+ * Convert a short hash value to a string (for printing debug messages).
+ * This prints all 104 characters of a hashcode!
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param hc the short hash code
+ * @return string
+ */
+const char *
+GNUNET_short_h2s_full (const struct GNUNET_CRYPTO_ShortHashCode * hc);
+
+
+/**
* Convert a hash value to a string (for printing debug messages).
* This is one of the very few calls in the entire API that is
* NOT reentrant!
Modified: gnunet/src/include/gnunet_crypto_lib.h
===================================================================
--- gnunet/src/include/gnunet_crypto_lib.h 2012-09-18 13:38:44 UTC (rev
23887)
+++ gnunet/src/include/gnunet_crypto_lib.h 2012-09-18 13:53:39 UTC (rev
23888)
@@ -137,18 +137,7 @@
};
-
-
/**
- * @brief 256-bit hashcode
- */
-struct GNUNET_CRYPTO_ShortHashCode
-{
- uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */
-};
-
-
-/**
* @brief 0-terminated ASCII encoding of a 'struct GNUNET_ShortHashCode'.
*/
struct GNUNET_CRYPTO_ShortHashAsciiEncoded
Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c 2012-09-18 13:38:44 UTC (rev 23887)
+++ gnunet/src/util/common_logging.c 2012-09-18 13:53:39 UTC (rev 23888)
@@ -1012,6 +1012,43 @@
/**
+ * 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);
+ ret.short_encoding[8] = '\0';
+ return (const char *) ret.short_encoding;
+}
+
+
+/**
+ * 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_full.
+ */
+const char *
+GNUNET_short_h2s_full (const struct GNUNET_CRYPTO_ShortHashCode * hc)
+{
+ static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret;
+
+ GNUNET_CRYPTO_short_hash_to_enc (hc, &ret);
+ ret.short_encoding[sizeof (ret) - 1] = '\0';
+ return (const char *) ret.short_encoding;
+}
+
+/**
* 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!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23888 - in gnunet/src: gns include util,
gnunet <=