84hex_dec(
const void *in_enc,
size_t len,
void *out_raw,
size_t out_cap)
86 const char *in_str = in_enc;
87 uint8_t *out = out_raw;
90 if ((len % 2 != 0) || (out_cap < len / 2))
93 for (
size_t i = 0, j = 0; i < len && j < out_cap; i += 2, j++) {
94 int a = xdigit2int(in_str[i]);
95 int b = xdigit2int(in_str[i + 1]);
97 if (a == -1 || b == -1)
99 out[j] = (a << 4) | b;