RDK Documentation (Open Sourced RDK Components)
base16.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 #ifndef BASE16_H
21 #define BASE16_H
22 
23 /**
24  * @file base16.h
25  * @brief optimized way way base16 Encode/Decode operation
26  */
27 
28 #include <stddef.h>
29 
30 
31 /**
32  * @fn base16_Encode
33  * @param src pointer to first byte of binary data to be encoded
34  * @param len number of bytes to encode
35  */
36 char *base16_Encode(const unsigned char *src, size_t len);
37 
38 
39 /**
40  * @fn base16_Decode
41  * @param srcPtr pointer to cstring containing base16-encoded data
42  * @param srcLen length of srcPtr (typically caller already knows, so saves call to strlen)
43  * @param len receives byte length of returned pointer, or zero upon failure
44  */
45 unsigned char *base16_Decode(const char *srcPtr, size_t srcLen, size_t *len);
46 
47 #endif // BASE16_H
base16_Encode
char * base16_Encode(const unsigned char *src, size_t len)
convert binary data to hascii-encoded equivalent
Definition: base16.cpp:39
base16_Decode
unsigned char * base16_Decode(const char *srcPtr, size_t srcLen, size_t *len)
decode base16 encoded data to binary equivalent
Definition: base16.cpp:64