add hex_to_str

This commit is contained in:
2024-03-29 07:18:01 -07:00
parent f60bea0fdd
commit 0408b8d499
4 changed files with 28 additions and 0 deletions

View File

@ -56,4 +56,13 @@ for (size_t i = 0; i < 4; ++i) {
assert(s[i] == h[i]);
}
free(s);
```
### hex_to_str
Converts an array of `unsigned char` into a string based on the ASCII values of each byte. User is
responsible for freeing the returned string.
```c
const char *hex_to_str(const unsigned char *hex, size_t sz);
```