1OPENSSL_HEXCHAR2INT(3ossl)          OpenSSL         OPENSSL_HEXCHAR2INT(3ossl)
2
3
4

NAME

6       OPENSSL_hexchar2int, OPENSSL_hexstr2buf_ex, OPENSSL_hexstr2buf,
7       OPENSSL_buf2hexstr_ex, OPENSSL_buf2hexstr - Hex encoding and decoding
8       functions
9

SYNOPSIS

11        #include <openssl/crypto.h>
12
13        int OPENSSL_hexchar2int(unsigned char c);
14        int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, long *buflen,
15                                  const char *str, const char sep);
16        unsigned char *OPENSSL_hexstr2buf(const char *str, long *len);
17        int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength,
18                                  const unsigned char *buf, long buflen,
19                                  const char sep);
20        char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
21

DESCRIPTION

23       OPENSSL_hexchar2int() converts a hexadecimal character to its numeric
24       equivalent.
25
26       OPENSSL_hexstr2buf_ex() decodes the hex string str and places the
27       resulting string of bytes in the given buf.  The character sep is the
28       separator between the bytes, setting this to '\0' means that there is
29       no separator.  buf_n gives the size of the buffer.  If buflen is not
30       NULL, it is filled in with the result length.  To find out how large
31       the result will be, call this function with NULL for buf.  Colons
32       between two-character hex "bytes" are accepted and ignored.  An odd
33       number of hex digits is an error.
34
35       OPENSSL_hexstr2buf() does the same thing as OPENSSL_hexstr2buf_ex(),
36       but allocates the space for the result, and returns the result. It uses
37       a default separator of ':'.  The memory is allocated by calling
38       OPENSSL_malloc() and should be released by calling OPENSSL_free().
39
40       OPENSSL_buf2hexstr_ex() encodes the contents of the given buf with
41       length buflen and places the resulting hexadecimal character string in
42       the given str.  The character sep is the separator between the bytes,
43       setting this to '\0' means that there is no separator.  str_n gives the
44       size of the of the string buffer.  If strlength is not NULL, it is
45       filled in with the result length.  To find out how large the result
46       will be, call this function with NULL for str.
47
48       OPENSSL_buf2hexstr() does the same thing as OPENSSL_buf2hexstr_ex(),
49       but allocates the space for the result, and returns the result. It uses
50       a default separator of ':'.  The memory is allocated by calling
51       OPENSSL_malloc() and should be released by calling OPENSSL_free().
52

RETURN VALUES

54       OPENSSL_hexchar2int returns the value of a decoded hex character, or -1
55       on error.
56
57       OPENSSL_buf2hexstr() and OPENSSL_hexstr2buf() return a pointer to
58       allocated memory, or NULL on error.
59
60       OPENSSL_buf2hexstr_ex() and OPENSSL_hexstr2buf_ex() return 1 on
61       success, or 0 on error.
62
64       Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
65
66       Licensed under the Apache License 2.0 (the "License").  You may not use
67       this file except in compliance with the License.  You can obtain a copy
68       in the file LICENSE in the source distribution or at
69       <https://www.openssl.org/source/license.html>.
70
71
72
733.0.5                             2022-11-01        OPENSSL_HEXCHAR2INT(3ossl)
Impressum