From 5fcc23ae0a08e6846a4d0fbfdb51627559929068 Mon Sep 17 00:00:00 2001 From: Lee Clagett <code@leeclagett.com> Date: Sun, 17 Nov 2019 04:29:18 +0000 Subject: Move hex->bin conversion to monero copyright files and with less includes --- contrib/epee/include/hex.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'contrib/epee/include/hex.h') 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); }; } -- cgit v1.2.3