37 lines
881 B
C
37 lines
881 B
C
#ifndef DI_MISC_HEXSTR_H_
|
|
#define DI_MISC_HEXSTR_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stddef.h>
|
|
|
|
/**
|
|
* @note The function will silently skip any non-hexadecimal characters it encounters
|
|
* @param dst Binary output buffer
|
|
* @param dst_len Binary output buffer size
|
|
* @param src Buffer of input string (may exclude null character)
|
|
* @param src_len Size of src (excluding null character)
|
|
*/
|
|
void di_hexstr_to_bin(
|
|
void *dst, size_t dst_len,
|
|
const void *src, size_t src_len);
|
|
|
|
/**
|
|
* Convert binary data to hex-string
|
|
* @param dst Buffer of output string
|
|
* @param dst_len Size of dst (excluding null character)
|
|
* @param src Binary input buffer
|
|
* @param src_len Binary input buffer length
|
|
*/
|
|
void di_hexstr_from_bin(
|
|
void *dst, size_t dst_len,
|
|
const void *src, size_t src_len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* DI_MISC_HEXSTR_H_ */
|