summaryrefslogtreecommitdiff
path: root/src/messenger/messenger_api_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/messenger_api_util.c')
-rw-r--r--src/messenger/messenger_api_util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/messenger/messenger_api_util.c b/src/messenger/messenger_api_util.c
index 68e15d789..4ad00c45e 100644
--- a/src/messenger/messenger_api_util.c
+++ b/src/messenger/messenger_api_util.c
@@ -82,3 +82,19 @@ get_anonymous_public_key ()
return &public_key;
}
+
+void
+convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port)
+{
+ static uint32_t version_value = 0;
+ static struct GNUNET_HashCode version;
+
+ if (!version_value) {
+ version_value = (uint32_t) (GNUNET_MESSENGER_VERSION);
+ version_value = ((version_value >> 16) & 0xFFFF);
+ version_value = GNUNET_htole32(version_value);
+ GNUNET_CRYPTO_hash(&version_value, sizeof(version_value), &version);
+ }
+
+ GNUNET_CRYPTO_hash_sum(key, &version, port);
+}