aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/hex.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2019-11-17 04:29:18 +0000
committerLee Clagett <code@leeclagett.com>2020-03-09 05:23:59 +0000
commit5fcc23ae0a08e6846a4d0fbfdb51627559929068 (patch)
treec2ab745028c3d5ce9c3e404392132400dcf2acf3 /contrib/epee/include/hex.h
parentRemove temporary std::string creation in some hex->bin calls (diff)
downloadmonero-5fcc23ae0a08e6846a4d0fbfdb51627559929068.tar.xz
Move hex->bin conversion to monero copyright files and with less includes
Diffstat (limited to 'contrib/epee/include/hex.h')
-rw-r--r--contrib/epee/include/hex.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/contrib/epee/include/hex.h b/contrib/epee/include/hex.h
index 4e8f90786..8443cb92f 100644
--- a/contrib/epee/include/hex.h
+++ b/contrib/epee/include/hex.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2019, The Monero Project
+// Copyright (c) 2017-2020, The Monero Project
//
// All rights reserved.
//
@@ -80,9 +80,20 @@ namespace epee
static void buffer_unchecked(char* out, const span<const std::uint8_t> src) noexcept;
};
+ //! Convert hex in UTF8 encoding to binary
struct from_hex
{
- //! \return An std::vector of unsigned integers from the `src`
- static std::vector<uint8_t> vector(boost::string_ref src);
+ static bool to_string(std::string& out, boost::string_ref src);
+
+ static bool to_buffer(span<std::uint8_t> out, boost::string_ref src) noexcept;
+
+ private:
+ static bool to_buffer_unchecked(std::uint8_t* out, boost::string_ref src) noexcept;
+ };
+
+ //! Convert hex in current C locale encoding to binary
+ struct from_hex_locale
+ {
+ static std::vector<uint8_t> to_vector(boost::string_ref src);
};
}