1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (C) 2022 Intel Corporation. 3 * All rights reserved. 4 */ 5 6 #ifndef SPDK_HEXLIFY_H 7 #define SPDK_HEXLIFY_H 8 9 #include "spdk/stdinc.h" 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 /** 16 * Convert a binary array to hexlified string terminated by zero. 17 * 18 * \param bin A binary array pointer. 19 * \param len Length of the binary array. 20 * \return Pointer to hexlified version of @bin or NULL on failure. 21 */ 22 char *spdk_hexlify(const char *bin, size_t len); 23 24 /** 25 * Convert hexlified string to binary array of size strlen(hex) / 2. 26 * 27 * \param hex A hexlified string terminated by zero. 28 * \return Binary array pointer or NULL on failure. 29 */ 30 char *spdk_unhexlify(const char *hex); 31 32 #ifdef __cplusplus 33 } 34 #endif 35 36 #endif /* SPDK_HEXLIFY_H */ 37