diff options
author | luigi1111 <luigi1111w@gmail.com> | 2020-04-04 12:55:02 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2020-04-04 12:55:02 -0500 |
commit | cfc0f4a7fa67dd880d51c0aa35baa1e73e5db423 (patch) | |
tree | 932e460664a6329d5b9906506d1d6951378768a2 /contrib/epee/include/hex.h | |
parent | Merge pull request #6347 (diff) | |
parent | Reduce template bloat in hex->bin for ZMQ json (diff) | |
download | monero-cfc0f4a7fa67dd880d51c0aa35baa1e73e5db423.tar.xz |
Merge pull request #6351
81c5943 Remove temporary std::string creation in some hex->bin calls (vtnerd)
5fcc23a Move hex->bin conversion to monero copyright files and with less includes (vtnerd)
3387f0e Reduce template bloat in hex->bin for ZMQ json (vtnerd)
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); }; } |