aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/hash.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-09-25 22:27:43 +0200
committerRiccardo Spagni <ric@spagni.net>2017-09-25 22:27:44 +0200
commit29d601563fff1a23fa5c21de8c455d542b1adfe3 (patch)
tree4a071ec0ef979f020a2cf567973e02087494e8b9 /src/crypto/hash.h
parentMerge pull request #2466 (diff)
parentwallet2: do not keep block hashes below last checkpoint (diff)
downloadmonero-29d601563fff1a23fa5c21de8c455d542b1adfe3.tar.xz
Merge pull request #2434
36c3465b wallet2: do not keep block hashes below last checkpoint (moneromooo-monero) cdbbe99c checkpoints: add a token checkpoint on testnet (the genesis block) (moneromooo-monero) 493fad80 serialization: add deque serialization (moneromooo-monero) fa54b205 fix typo in basic and core CMakeLists.txt (moneromooo-monero) 5d65a75b move checkpoints in a separate library (moneromooo-monero)
Diffstat (limited to 'src/crypto/hash.h')
-rw-r--r--src/crypto/hash.h13
1 files changed, 13 insertions, 0 deletions
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)