aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src/hex.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-07-07 00:03:15 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-16 09:17:52 +0000
commitea37614efe518ff8f363ddf2465301687e04d977 (patch)
tree17a975260d2943c18f3a19c51bb6bc88dd26b98c /contrib/epee/src/hex.cpp
parentMerge pull request #4191 (diff)
downloadmonero-ea37614efe518ff8f363ddf2465301687e04d977.tar.xz
wallet: wipe seed from memory where appropriate
Diffstat (limited to '')
-rw-r--r--contrib/epee/src/hex.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/epee/src/hex.cpp b/contrib/epee/src/hex.cpp
index c143b2dc2..5c8acc8be 100644
--- a/contrib/epee/src/hex.cpp
+++ b/contrib/epee/src/hex.cpp
@@ -52,17 +52,21 @@ namespace epee
}
}
- std::string to_hex::string(const span<const std::uint8_t> src)
+ template<typename T>
+ T to_hex::convert(const span<const std::uint8_t> src)
{
if (std::numeric_limits<std::size_t>::max() / 2 < src.size())
throw std::range_error("hex_view::to_string exceeded maximum size");
- std::string out{};
+ T out{};
out.resize(src.size() * 2);
- buffer_unchecked(std::addressof(out[0]), src);
+ to_hex::buffer_unchecked((char*)out.data(), src); // can't see the non const version in wipeable_string??
return out;
}
+ 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); }
+
void to_hex::buffer(std::ostream& out, const span<const std::uint8_t> src)
{
write_hex(std::ostreambuf_iterator<char>{out}, src);