Move hex->bin conversion to monero copyright files and with less includes

This commit is contained in:
Lee Clagett 2019-11-17 04:29:18 +00:00
parent 81c5943453
commit 5fcc23ae0a
7 changed files with 104 additions and 42 deletions

View file

@ -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);
};
}