diff options
Diffstat (limited to 'contrib/epee/include/hex.h')
-rw-r--r-- | contrib/epee/include/hex.h | 17 |
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); }; } |