Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_hex.c File Reference

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>
+ Include dependency graph for n_hex.c:

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.
 
N_STRn_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.
 
static int n_hex_value (int c)
 

Variables

static const char n_hex_digits [] = "0123456789abcdef"
 lowercase hexadecimal digit table
 

Detailed Description

Hexadecimal encode/decode helpers.

Author
Castagnier Mickael
Version
1.0

Definition in file n_hex.c.

Function Documentation

◆ n_hex_value()

static int n_hex_value ( int  c)
static

Definition at line 41 of file n_hex.c.

Referenced by n_hex_decode().

+ Here is the caller graph for this function:

Variable Documentation

◆ n_hex_digits

const char n_hex_digits[] = "0123456789abcdef"
static

lowercase hexadecimal digit table

Definition at line 38 of file n_hex.c.

Referenced by n_hex_encode().