aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-16 21:36:22 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-16 21:36:38 +0200
commitda393a04d06d488bc3b424a8baa24676b53e6352 (patch)
tree1791dfd7a18919c065f0b945c65dd62d1a7727bf /src/util/common_logging.c
parent215e607f63847c77bd26d4c97eae8c7d6ca7f4a0 (diff)
downloadgnunet-da393a04d06d488bc3b424a8baa24676b53e6352.tar.gz
gnunet-da393a04d06d488bc3b424a8baa24676b53e6352.zip
log key material hashes
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index ea5430191..df501fbcd 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1192,6 +1192,106 @@ GNUNET_h2s2 (const struct GNUNET_HashCode * hc)
1192 1192
1193/** 1193/**
1194 * @ingroup logging 1194 * @ingroup logging
1195 * Convert a public key value to a string (for printing debug messages).
1196 * This is one of the very few calls in the entire API that is
1197 * NOT reentrant!
1198 *
1199 * @param hc the hash code
1200 * @return string
1201 */
1202const char *
1203GNUNET_p2s (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
1204{
1205 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1206 struct GNUNET_HashCode hc;
1207
1208 GNUNET_CRYPTO_hash (p,
1209 sizeof (*p),
1210 &hc);
1211 GNUNET_CRYPTO_hash_to_enc (&hc,
1212 &ret);
1213 ret.encoding[6] = '\0';
1214 return (const char *) ret.encoding;
1215}
1216
1217
1218/**
1219 * @ingroup logging
1220 * Convert a public key value to a string (for printing debug messages).
1221 * This is one of the very few calls in the entire API that is
1222 * NOT reentrant!
1223 *
1224 * @param hc the hash code
1225 * @return string
1226 */
1227const char *
1228GNUNET_p2s2 (const struct GNUNET_CRYPTO_EddsaPublicKey *p)
1229{
1230 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1231 struct GNUNET_HashCode hc;
1232
1233 GNUNET_CRYPTO_hash (p,
1234 sizeof (*p),
1235 &hc);
1236 GNUNET_CRYPTO_hash_to_enc (&hc,
1237 &ret);
1238 ret.encoding[6] = '\0';
1239 return (const char *) ret.encoding;
1240}
1241
1242
1243/**
1244 * @ingroup logging
1245 * Convert a public key value to a string (for printing debug messages).
1246 * This is one of the very few calls in the entire API that is
1247 * NOT reentrant!
1248 *
1249 * @param hc the hash code
1250 * @return string
1251 */
1252const char *
1253GNUNET_e2s (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
1254{
1255 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1256 struct GNUNET_HashCode hc;
1257
1258 GNUNET_CRYPTO_hash (p,
1259 sizeof (*p),
1260 &hc);
1261 GNUNET_CRYPTO_hash_to_enc (&hc,
1262 &ret);
1263 ret.encoding[6] = '\0';
1264 return (const char *) ret.encoding;
1265}
1266
1267
1268/**
1269 * @ingroup logging
1270 * Convert a public key value to a string (for printing debug messages).
1271 * This is one of the very few calls in the entire API that is
1272 * NOT reentrant!
1273 *
1274 * @param hc the hash code
1275 * @return string
1276 */
1277const char *
1278GNUNET_e2s2 (const struct GNUNET_CRYPTO_EcdhePublicKey *p)
1279{
1280 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
1281 struct GNUNET_HashCode hc;
1282
1283 GNUNET_CRYPTO_hash (p,
1284 sizeof (*p),
1285 &hc);
1286 GNUNET_CRYPTO_hash_to_enc (&hc,
1287 &ret);
1288 ret.encoding[6] = '\0';
1289 return (const char *) ret.encoding;
1290}
1291
1292
1293/**
1294 * @ingroup logging
1195 * Convert a short hash value to a string (for printing debug messages). 1295 * Convert a short hash value to a string (for printing debug messages).
1196 * This is one of the very few calls in the entire API that is 1296 * This is one of the very few calls in the entire API that is
1197 * NOT reentrant! 1297 * NOT reentrant!