From 93e10f1cc40f31aa4fd10ed09a42cc9caa3bdd8c Mon Sep 17 00:00:00 2001 From: Lee Clagett Date: Thu, 9 Mar 2017 15:50:51 -0500 Subject: Simplified the implementation and features of span --- src/cryptonote_basic/cryptonote_basic_impl.h | 29 +++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/cryptonote_basic/cryptonote_basic_impl.h') 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; + } } -- cgit v1.2.3