12 template <
unsigned int BITS>
15 assert(vch.size() ==
sizeof(m_data));
16 memcpy(m_data, vch.data(),
sizeof(m_data));
19 template <
unsigned int BITS>
22 uint8_t m_data_rev[WIDTH];
23 for (
int i = 0; i < WIDTH; ++i) {
24 m_data_rev[i] = m_data[WIDTH - 1 - i];
29 template <
unsigned int BITS>
32 memset(m_data, 0,
sizeof(m_data));
39 if (psz[0] ==
'0' &&
ToLower(psz[1]) ==
'x')
44 while (::
HexDigit(psz[digits]) != -1)
46 unsigned char* p1 = (
unsigned char*)m_data;
47 unsigned char* pend = p1 + WIDTH;
48 while (digits > 0 && p1 < pend) {
51 *p1 |= ((
unsigned char)::
HexDigit(psz[--digits]) << 4);
57 template <
unsigned int BITS>
63 template <
unsigned int BITS>
std::string ToLower(const std::string &str)
Returns the lowercase equivalent of the given string.
signed char HexDigit(char c)
static const uint256 ZERO
std::string ToString() const
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
void * memcpy(void *a, const void *b, size_t c)
constexpr bool IsSpace(char c) noexcept
Tests if the given character is a whitespace character.
std::string GetHex() const
void SetHex(const char *psz)