aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-09-18 13:53:39 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-09-18 13:53:39 +0000
commit4e27ba9acbde9726ea29ccb4fbcc1afdfb80de8c (patch)
tree9b35525a2ba0b110391522f3cff7fe16265fe731 /src/util/common_logging.c
parenta20d199156116af29256197c72ea9168fc78fc5f (diff)
downloadgnunet-4e27ba9acbde9726ea29ccb4fbcc1afdfb80de8c.tar.gz
gnunet-4e27ba9acbde9726ea29ccb4fbcc1afdfb80de8c.zip
-short hash output func
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index fbc0de50c..6161d0c6d 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1012,6 +1012,43 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind)
1012 1012
1013 1013
1014/** 1014/**
1015 * Convert a short hash to a string (for printing debug messages).
1016 * This is one of the very few calls in the entire API that is
1017 * NOT reentrant!
1018 *
1019 * @param hc the short hash code
1020 * @return string form; will be overwritten by next call to GNUNET_h2s.
1021 */
1022const char *
1023GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc)
1024{
1025 static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret;
1026
1027 GNUNET_CRYPTO_short_hash_to_enc (hc, &ret);
1028 ret.short_encoding[8] = '\0';
1029 return (const char *) ret.short_encoding;
1030}
1031
1032
1033/**
1034 * Convert a short hash to a string (for printing debug messages).
1035 * This is one of the very few calls in the entire API that is
1036 * NOT reentrant!
1037 *
1038 * @param hc the short hash code
1039 * @return string form; will be overwritten by next call to GNUNET_h2s_full.
1040 */
1041const char *
1042GNUNET_short_h2s_full (const struct GNUNET_CRYPTO_ShortHashCode * hc)
1043{
1044 static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret;
1045
1046 GNUNET_CRYPTO_short_hash_to_enc (hc, &ret);
1047 ret.short_encoding[sizeof (ret) - 1] = '\0';
1048 return (const char *) ret.short_encoding;
1049}
1050
1051/**
1015 * Convert a hash to a string (for printing debug messages). 1052 * Convert a hash to a string (for printing debug messages).
1016 * This is one of the very few calls in the entire API that is 1053 * This is one of the very few calls in the entire API that is
1017 * NOT reentrant! 1054 * NOT reentrant!