![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Hexadecimal encode/decode helpers. More...
#include "nilorea/n_hex.h"#include "nilorea/n_common.h"#include "nilorea/n_log.h"#include "nilorea/n_str.h"#include <ctype.h>#include <stdint.h>#include <string.h>Go to the source code of this file.
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. | |
| int | n_hex_decode_to (unsigned char *out, size_t out_size, const char *hex, size_t nbytes) |
| decode exactly nbytes bytes from the first 2*nbytes hex digits of hex (case-insensitive, no embedded whitespace) into the caller-provided buffer out (needs out_size >= nbytes). | |
| 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. | |
| size_t | n_hex_encode_to (char *out, size_t out_size, const unsigned char *data, size_t len) |
| encode len bytes of data as lowercase hex into the caller-provided buffer out (needs out_size >= 2*len+1), NUL-terminating on success. | |
| static int | n_hex_value (int c) |
Variables | |
| static const char | n_hex_digits [] = "0123456789abcdef" |
| lowercase hexadecimal digit table | |
|
static |
Definition at line 41 of file n_hex.c.
Referenced by n_hex_decode(), and n_hex_decode_to().
|
static |
lowercase hexadecimal digit table
Definition at line 38 of file n_hex.c.
Referenced by n_hex_encode(), and n_hex_encode_to().