From eb943562cba9612709e592db279d270b916c0b66 Mon Sep 17 00:00:00 2001 From: Lee *!* Clagett Date: Sun, 21 May 2023 13:41:27 -0400 Subject: Add to_hex::buffer --- contrib/epee/src/hex.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'contrib/epee/src') diff --git a/contrib/epee/src/hex.cpp b/contrib/epee/src/hex.cpp index edc7d46f4..625f37c2f 100644 --- a/contrib/epee/src/hex.cpp +++ b/contrib/epee/src/hex.cpp @@ -69,6 +69,14 @@ namespace epee std::string to_hex::string(const span src) { return convert(src); } epee::wipeable_string to_hex::wipeable_string(const span src) { return convert(src); } + bool to_hex::buffer(span out, const span src) noexcept + { + if (out.size() % 2 != 0 || out.size() / 2 != src.size()) + return false; + to_hex::buffer_unchecked(out.data(), src); + return true; + } + void to_hex::buffer(std::ostream& out, const span src) { write_hex(std::ostreambuf_iterator{out}, src); -- cgit v1.2.3