13static inline std::string
hex_encode(std::string_view data)
16 ret.reserve(data.size() * 2);
17 for (
unsigned char c : data) {
18 ret.push_back(
hex_chars[(c & 0xf0) >> 4]);
25static inline std::string
hex_encode(
const char *data,
size_t data_size)
29 return hex_encode(std::string_view(data, data_size));
34 if (hexdigit >=
'0' && hexdigit <=
'9')
35 value = hexdigit -
'0';
36 else if (hexdigit >=
'A' && hexdigit <=
'F')
37 value = hexdigit -
'A' + 10;
38 else if (hexdigit >=
'a' && hexdigit <=
'f')
39 value = hexdigit -
'a' + 10;
static bool hex_digit_decode(char hexdigit, unsigned char &value)
Definition hex.h:32
static const char hex_chars[]
Definition hex.h:10
static std::string hex_encode(std::string_view data)
Definition hex.h:13