21 const std::string random_hex_string(buffer.begin(), buffer.end());
22 const std::vector<unsigned char> data =
ParseHex(random_hex_string);
23 const std::vector<std::byte> bytes{ParseHex<std::byte>(random_hex_string)};
25 const std::string hex_data =
HexStr(data);
26 if (
IsHex(random_hex_string)) {
A Span is an object that can refer to a contiguous sequence of objects.
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
bool ParseHashStr(const std::string &strHex, uint256 &result)
Parse a hex string into 256 bits.
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
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.
uint256 uint256S(const char *str)
bool IsHexNumber(std::string_view str)
Return true if the string is a hex number, optionally prefixed with "0x".
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
bool IsHex(std::string_view str)
std::string ToLower(std::string_view str)
Returns the lowercase equivalent of the given string.