aboutsummaryrefslogtreecommitdiff
path: root/include/sibs/PubsubKey.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/sibs/PubsubKey.hpp')
-rw-r--r--include/sibs/PubsubKey.hpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/include/sibs/PubsubKey.hpp b/include/sibs/PubsubKey.hpp
index d123331..f1239ca 100644
--- a/include/sibs/PubsubKey.hpp
+++ b/include/sibs/PubsubKey.hpp
@@ -1,21 +1,14 @@
#pragma once
+#include "../FnvHash.hpp"
#include "../types.hpp"
#include <array>
#include <unordered_map>
+#include <string>
namespace sibs
{
- const usize PUBSUB_KEY_LENGTH = 32;
-
- // Source: https://stackoverflow.com/a/11414104 (public license)
- static size_t fnvHash(const unsigned char *key, int len)
- {
- size_t h = 2166136261;
- for (int i = 0; i < len; i++)
- h = (h * 16777619) ^ key[i];
- return h;
- }
+ const usize PUBSUB_KEY_LENGTH = 20;
class PubsubKey
{
@@ -26,6 +19,8 @@ namespace sibs
bool operator == (const PubsubKey &other) const;
bool operator != (const PubsubKey &other) const;
+ std::string toString() const;
+
std::array<u8, PUBSUB_KEY_LENGTH> data;
};