23 const std::string random_hex_string(buffer.begin(), buffer.end());
24 const std::vector<unsigned char>
data =
ParseHex(random_hex_string);
25 const std::vector<std::byte> bytes{ParseHex<std::byte>(random_hex_string)};
28 if (
IsHex(random_hex_string)) {
32 assert(random_hex_string.length() == 64);
38 const auto result_string{result->ToString()};
39 assert(result_string.length() == 64);
A Span is an object that can refer to a contiguous sequence of objects.
static std::optional< transaction_identifier > FromHex(std::string_view hex)
static std::optional< uint256 > FromUserHex(std::string_view str)
static std::optional< uint256 > FromHex(std::string_view str)
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
CPubKey HexToPubKey(const std::string &hex_in)
Span< const std::byte > AsBytes(Span< T > s) noexcept
std::vector< Byte > ParseHex(std::string_view hex_str)
Like TryParseHex, but returns an empty vector on invalid input.
bool IsHex(std::string_view str)
std::optional< std::vector< Byte > > TryParseHex(std::string_view str)
Parse the hex string into bytes (uint8_t or std::byte).
std::string ToLower(std::string_view str)
Returns the lowercase equivalent of the given string.