aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-10 17:35:59 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-25 21:16:26 +0100
commit5d65a75b69e0e83e69384461f26111666d6bf9ae (patch)
tree9205cb60d67464ca5bfc299e8d658bfd4e6e21ae /src/crypto
parentMerge pull request #2466 (diff)
downloadmonero-5d65a75b69e0e83e69384461f26111666d6bf9ae.tar.xz
move checkpoints in a separate library
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/crypto.h22
-rw-r--r--src/crypto/hash.h13
2 files changed, 35 insertions, 0 deletions
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h
index e99b6651f..94f924296 100644
--- a/src/crypto/crypto.h
+++ b/src/crypto/crypto.h
@@ -31,12 +31,16 @@
#pragma once
#include <cstddef>
+#include <iostream>
#include <boost/thread/mutex.hpp>
#include <boost/thread/lock_guard.hpp>
+#include <boost/utility/value_init.hpp>
#include <vector>
#include "common/pod-class.h"
#include "generic-ops.h"
+#include "hex.h"
+#include "span.h"
#include "hash.h"
namespace crypto {
@@ -248,6 +252,24 @@ namespace crypto {
const signature *sig) {
return check_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sig);
}
+
+ inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) {
+ epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
+ }
+ inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) {
+ epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
+ }
+ inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) {
+ epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
+ }
+ inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) {
+ epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
+ }
+ inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) {
+ epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
+ }
+
+ const static crypto::public_key null_pkey = boost::value_initialized<crypto::public_key>();
}
CRYPTO_MAKE_HASHABLE(public_key)
diff --git a/src/crypto/hash.h b/src/crypto/hash.h
index 22991e513..610b4502f 100644
--- a/src/crypto/hash.h
+++ b/src/crypto/hash.h
@@ -31,9 +31,13 @@
#pragma once
#include <stddef.h>
+#include <iostream>
+#include <boost/utility/value_init.hpp>
#include "common/pod-class.h"
#include "generic-ops.h"
+#include "hex.h"
+#include "span.h"
namespace crypto {
@@ -75,6 +79,15 @@ namespace crypto {
tree_hash(reinterpret_cast<const char (*)[HASH_SIZE]>(hashes), count, reinterpret_cast<char *>(&root_hash));
}
+ inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) {
+ epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
+ }
+ inline std::ostream &operator <<(std::ostream &o, const crypto::hash8 &v) {
+ epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
+ }
+
+ const static crypto::hash null_hash = boost::value_initialized<crypto::hash>();
+ const static crypto::hash8 null_hash8 = boost::value_initialized<crypto::hash8>();
}
CRYPTO_MAKE_HASHABLE(hash)