bin2hex()

bin2hex()#

bin2hex converts a binary buffer into a hexadecimal string representation.

Prototype

char *bin2hex(
    char *bf,
    int bfsize,
    const uint8_t *bin,
    size_t bin_len
);

Parameters

Key

Type

Description

bf

char *

Pointer to the output buffer where the hexadecimal string will be stored.

bfsize

int

Size of the output buffer in bytes.

bin

const uint8_t *

Pointer to the input binary data to be converted.

bin_len

size_t

Length of the input binary data in bytes.


Return Value

Returns a pointer to the output buffer bf containing the hexadecimal string.

Notes

The output buffer bf must be large enough to store the hexadecimal representation (2 * bin_len + 1 bytes for the null terminator).

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples