6 OPENSSL_hexstr2buf_ex, OPENSSL_hexstr2buf,
7 OPENSSL_buf2hexstr_ex, OPENSSL_buf2hexstr
8 - Hex encoding and decoding functions
12 #include <openssl/crypto.h>
14 int OPENSSL_hexchar2int(unsigned char c);
15 int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, long *buflen,
16 const char *str, const char sep);
17 unsigned char *OPENSSL_hexstr2buf(const char *str, long *len);
18 int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlen,
19 const unsigned char *buf, long buflen, const char sep);
20 char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
24 OPENSSL_hexchar2int() converts a hexadecimal character to its numeric
27 OPENSSL_hexstr2buf_ex() decodes the hex string B<str> and places the
28 resulting string of bytes in the given I<buf>.
29 The character I<sep> is the separator between the bytes, which is normally ':',
30 Setting this to '\0' means that there is no seperator.
31 I<buf_n> gives the size of the buffer.
32 If I<buflen> is not NULL, it is filled in with the result length.
33 To find out how large the result will be, call this function with NULL
35 Colons between two-character hex "bytes" are accepted and ignored.
36 An odd number of hex digits is an error.
38 OPENSSL_hexstr2buf() does the same thing as OPENSSL_hexstr2buf_ex(),
39 but allocates the space for the result, and returns the result.
40 The memory is allocated by calling OPENSSL_malloc() and should be
41 released by calling OPENSSL_free().
43 OPENSSL_buf2hexstr_ex() encodes the contents of the given I<buf> with
44 length I<buflen> and places the resulting hexadecimal character string
46 The character I<sep> is the separator between the bytes, which is normally ':',
47 Setting this to '\0' means that there is no seperator.
48 I<str_n> gives the size of the of the string buffer.
49 If I<strlen> is not NULL, it is filled in with the result length.
50 To find out how large the result will be, call this function with NULL
53 OPENSSL_buf2hexstr() does the same thing as OPENSSL_buf2hexstr_ex(),
54 but allocates the space for the result, and returns the result.
55 The memory is allocated by calling OPENSSL_malloc() and should be
56 released by calling OPENSSL_free().
60 OPENSSL_hexchar2int returns the value of a decoded hex character,
63 OPENSSL_buf2hexstr() and OPENSSL_hexstr2buf()
64 return a pointer to allocated memory, or NULL on error.
66 OPENSSL_buf2hexstr_ex() and OPENSSL_hexstr2buf_ex() return 1 on
67 success, or 0 on error.
71 Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
73 Licensed under the Apache License 2.0 (the "License"). You may not use
74 this file except in compliance with the License. You can obtain a copy
75 in the file LICENSE in the source distribution or at
76 L<https://www.openssl.org/source/license.html>.