aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src
diff options
context:
space:
mode:
authorLee *!* Clagett <code@leeclagett.com>2023-05-21 13:41:27 -0400
committerLee *!* Clagett <code@leeclagett.com>2023-05-22 13:36:05 -0400
commiteb943562cba9612709e592db279d270b916c0b66 (patch)
treeffbc8c328b0186ebe2dfc219d098d1855ac55c26 /contrib/epee/src
parentMerge pull request #8842 (diff)
downloadmonero-eb943562cba9612709e592db279d270b916c0b66.tar.xz
Add to_hex::buffer
Diffstat (limited to 'contrib/epee/src')
-rw-r--r--contrib/epee/src/hex.cpp8
1 files changed, 8 insertions, 0 deletions
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<const std::uint8_t> src) { return convert<std::string>(src); }
epee::wipeable_string to_hex::wipeable_string(const span<const std::uint8_t> src) { return convert<epee::wipeable_string>(src); }
+ bool to_hex::buffer(span<char> out, const span<const std::uint8_t> 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<const std::uint8_t> src)
{
write_hex(std::ostreambuf_iterator<char>{out}, src);