35#include <boost/utility/string_ref.hpp>
51 template<std::
size_t N>
52 static std::array<char, N * 2>
array(
const std::array<std::uint8_t, N>& src)
noexcept
54 std::array<char, N * 2> out;
55 static_assert(N <= 128,
"keep the stack size down");
62 static std::array<char,
sizeof(
T) * 2>
array(
const T& src)
noexcept
64 std::array<char,
sizeof(
T) * 2> out;
65 static_assert(
sizeof(
T) <= 128,
"keep the stack size down");
86 static bool to_string(std::string& out, boost::string_ref src);
97 static std::vector<uint8_t>
to_vector(boost::string_ref src);
Non-owning sequence of data. Does not deep copy.
Definition span.h:55
Definition wipeable_string.h:41
TODO: (mj-xmr) This will be reduced in an another PR.
Definition byte_slice.h:40
span< const std::uint8_t > as_byte_span(const T &src) noexcept
Definition span.h:161
unsigned char uint8_t
Definition stdint.h:124
Convert hex in current C locale encoding to binary.
Definition hex.h:96
static std::vector< uint8_t > to_vector(boost::string_ref src)
Definition hex.cpp:124
Convert hex in UTF8 encoding to binary.
Definition hex.h:85
static bool to_string(std::string &out, boost::string_ref src)
Definition hex.cpp:90
static bool to_buffer(span< std::uint8_t > out, boost::string_ref src) noexcept
Definition hex.cpp:96
static bool to_buffer_unchecked(std::uint8_t *out, boost::string_ref src) noexcept
Definition hex.cpp:103
static epee::wipeable_string wipeable_string(const span< const std::uint8_t > src)
Definition hex.cpp:70
static std::array< char, N *2 > array(const std::array< std::uint8_t, N > &src) noexcept
Definition hex.h:52
static std::string string(const span< const std::uint8_t > src)
Definition hex.cpp:69
static void formatted(std::ostream &out, const span< const std::uint8_t > src)
Append < + src + > as hex to out.
Definition hex.cpp:77
static void buffer(std::ostream &out, const span< const std::uint8_t > src)
Append src as hex to out.
Definition hex.cpp:72
static T convert(const span< const std::uint8_t > src)
Definition hex.cpp:58
static std::array< char, sizeof(T) *2 > array(const T &src) noexcept
Definition hex.h:62
static epee::wipeable_string wipeable_string(const T &pod)
Definition hex.h:48
static void buffer_unchecked(char *out, const span< const std::uint8_t > src) noexcept
Write src bytes as hex to out. out must be twice the length.
Definition hex.cpp:84