aboutsummaryrefslogtreecommitdiff
path: root/src/PubsubKey.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-06-07 22:00:42 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-18 22:56:48 +0200
commitc2187ca6b61c701c281cc528db43f6b97c50f3d8 (patch)
treef0baf317846902ae628c2e12cf8c25b6eb235c77 /src/PubsubKey.cpp
parented71e8adf36e3d0c3f6f2b54794fe069091d3376 (diff)
Add bootstrap node, listen method
Diffstat (limited to 'src/PubsubKey.cpp')
-rw-r--r--src/PubsubKey.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/PubsubKey.cpp b/src/PubsubKey.cpp
new file mode 100644
index 0000000..dd807ce
--- /dev/null
+++ b/src/PubsubKey.cpp
@@ -0,0 +1,27 @@
+#include "../include/sibs/PubsubKey.hpp"
+
+namespace sibs
+{
+ PubsubKey::PubsubKey() :
+ data({})
+ {
+
+ }
+
+ PubsubKey::PubsubKey(const void *data, const usize size)
+ {
+ std::copy((char*)data, (char*)data + std::min(size, PUBSUB_KEY_LENGTH), this->data.begin());
+ if(size < PUBSUB_KEY_LENGTH)
+ std::fill_n((char*)data + size, PUBSUB_KEY_LENGTH - size, 0);
+ }
+
+ bool PubsubKey::operator == (const PubsubKey &other) const
+ {
+ return data == other.data;
+ }
+
+ bool PubsubKey::operator != (const PubsubKey &other) const
+ {
+ return data != other.data;
+ }
+}