diff options
author | Lee Clagett <code@leeclagett.com> | 2017-03-09 15:50:51 -0500 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2017-04-11 16:35:14 -0400 |
commit | 93e10f1cc40f31aa4fd10ed09a42cc9caa3bdd8c (patch) | |
tree | 27b42a557478acdee579b1f0ce649ca06218c1fc /src | |
parent | Improvements for epee binary to hex functions: (diff) | |
download | monero-93e10f1cc40f31aa4fd10ed09a42cc9caa3bdd8c.tar.xz |
Simplified the implementation and features of span
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_basic/cryptonote_basic_impl.h | 29 | ||||
-rw-r--r-- | src/ringct/rctTypes.h | 5 |
2 files changed, 26 insertions, 8 deletions
diff --git a/src/cryptonote_basic/cryptonote_basic_impl.h b/src/cryptonote_basic/cryptonote_basic_impl.h index 186ad85a0..14c03ac4c 100644 --- a/src/cryptonote_basic/cryptonote_basic_impl.h +++ b/src/cryptonote_basic/cryptonote_basic_impl.h @@ -34,6 +34,7 @@ #include "crypto/crypto.h" #include "crypto/hash.h" #include "hex.h" +#include "span.h" namespace cryptonote { @@ -127,11 +128,25 @@ namespace cryptonote { bool parse_hash256(const std::string str_hash, crypto::hash& hash); namespace crypto { - inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) { epee::to_hex::formatted_from_pod(o, v); return o; } - inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) { epee::to_hex::formatted_from_pod(o, v); return o; } - inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) { epee::to_hex::formatted_from_pod(o, v); return o; } - inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) { epee::to_hex::formatted_from_pod(o, v); return o; } - inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) { epee::to_hex::formatted_from_pod(o, v); return o; } - inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) { epee::to_hex::formatted_from_pod(o, v); return o; } - inline std::ostream &operator <<(std::ostream &o, const crypto::hash8 &v) { epee::to_hex::formatted_from_pod(o, v); return o; } + 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; + } + 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; + } } diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index baa99bbcb..c820fb297 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -48,6 +48,7 @@ extern "C" { #include "crypto/crypto.h" #include "hex.h" +#include "span.h" #include "serialization/serialization.h" #include "serialization/debug_archive.h" #include "serialization/binary_archive.h" @@ -444,7 +445,9 @@ namespace cryptonote { static inline bool operator!=(const crypto::secret_key &k0, const rct::key &k1) { return memcmp(&k0, &k1, 32); } } -inline std::ostream &operator <<(std::ostream &o, const rct::key &v) { epee::to_hex::formatted_from_pod(o, v); return o; } +inline std::ostream &operator <<(std::ostream &o, const rct::key &v) { + epee::to_hex::formatted(o, epee::as_byte_span(v)); return o; +} BLOB_SERIALIZER(rct::key); |