ec_hex_decode

March 26, 2020 Contributors

Name

ec_hex_decode — decodes bytes from ASCII hex characters

Synopsis

#include "util.h"

| int **ec_hex_decode** ( | src, |   |
|   | src_len, |   |
|   | dest, |   |
|   | dest_len); |   |

const char * <var class="pdparam">src</var>;
size_t <var class="pdparam">src_len</var>;
char * <var class="pdparam">dest</var>;
size_t <var class="pdparam">dest_len</var>;

Description

Note

This reference page was automatically generated from functions found in the header files in the development branch. The function described here may not exist in generally available versions of Momentum, and may change in behavior when it is generally available. Consult your vendor for definitive advice on the use of this function.

decodes bytes from ASCII hex characters

Reads src_len / 2 pairs of ASCII hex characters starting at src, and writes src_len / 2 bytes starting at dst. The first ASCII hex character in a pair becomes the most-significant nibble in the corresponding byte. Decoding stops early if an invalid ASCII hex character is reached.

Return Values

0 if dst_len is too small to hold the decoding or if src_len is not a multiple of 2; else returns the number of character pairs decoded.