sodium_hex2bin

* Hexadecimal decoding. * The sodium_hex2bin() function parses a hexadecimal string hex and converts it to a byte * sequence. * hex does not have to be nul terminated, as the number of characters to parse is supplied * via the hex_len parameter. * ignore is a string of characters to skip. For example, the string ": " allows columns and * spaces to be present at any locations in the hexadecimal string. These characters will just * be ignored. As a result, "69:FC" , "69 FC" , "69 : FC" and "69FC" will be valid inputs, * and will produce the same output. * ignore can be set to null in order to disallow any non-hexadecimal character. * bin_maxlen is the maximum number of bytes to put into bin . * The parser stops when a non-hexadecimal, non-ignored character is found or when * bin_maxlen bytes have been written. * The function returns -1 if more than bin_maxlen bytes would be required to store the * parsed string. It returns 0 on success and sets hex_end , if it is not null , to a pointer to * the character following the last parsed character. * It evaluates in constant time for a given length and format.

extern (C)
int
sodium_hex2bin
(
const(ubyte)* bin
,
const size_t bin_maxlen
,
const(char*) hex
,
const size_t hex_len
,
const(char*) ignore
,
const(size_t*) bin_len
,
const(char**) hex_end
)

Meta