![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Functions | |
| unsigned char * | n_hex_decode (const char *hex, size_t *out_len) |
| decode a hex string (ASCII whitespace between digits is ignored) into a freshly allocated, NUL-terminated byte buffer; *out_len receives the decoded byte count. | |
| N_STR * | n_hex_encode (const unsigned char *data, size_t len) |
| encode len bytes of data as a lowercase hex N_STR (2*len characters); free with free_nstr. | |
| unsigned char * n_hex_decode | ( | const char * | hex, |
| size_t * | out_len | ||
| ) |
decode a hex string (ASCII whitespace between digits is ignored) into a freshly allocated, NUL-terminated byte buffer; *out_len receives the decoded byte count.
Free the buffer with Free()/free(). Returns NULL on an odd number of hex digits or an invalid character.
Definition at line 71 of file n_hex.c.
References __n_assert, LOG_ERR, Malloc, n_hex_value(), and n_log.
Referenced by test_decode_errors(), and test_decode_roundtrip().
Here is the call graph for this function:
Here is the caller graph for this function:| N_STR * n_hex_encode | ( | const unsigned char * | data, |
| size_t | len | ||
| ) |
encode len bytes of data as a lowercase hex N_STR (2*len characters); free with free_nstr.
Returns NULL on a NULL/oversized input or on allocation failure.
Definition at line 48 of file n_hex.c.
References __n_assert, N_STR::data, LOG_ERR, n_hex_digits, n_log, new_nstr(), and N_STR::written.
Referenced by expect_encode(), expect_hex(), n_digest_sha256_hex(), n_random_hex_token(), and test_decode_roundtrip().
Here is the call graph for this function:
Here is the caller graph for this function: