BayEOSArduino Library
Base64.h
1 #ifndef _BASE64_H
2 #define _BASE64_H
3 
4 /* b64_alphabet:
5 * Description: Base64 alphabet table, a mapping between integers
6 * and base64 digits
7 * Notes: This is an extern here but is defined in Base64.c
8 */
9 extern const char b64_alphabet[];
10 
11 /* base64_encode:
12 * Description:
13 * Encode a string of characters as base64
14 * Parameters:
15 * output: the output buffer for the encoding, stores the encoded string
16 * input: the input buffer for the encoding, stores the binary to be encoded
17 * inputLen: the length of the input buffer, in bytes
18 * Return value:
19 * Returns the length of the encoded string
20 * Requirements:
21 * 1. output must not be null or empty
22 * 2. input must not be null
23 * 3. inputLen must be greater than or equal to 0
24 */
25 int base64_encode(char *output, char *input, int inputLen);
26 
27 /* base64_decode:
28 * Description:
29 * Decode a base64 encoded string into bytes
30 * Parameters:
31 * output: the output buffer for the decoding,
32 * stores the decoded binary
33 * input: the input buffer for the decoding,
34 * stores the base64 string to be decoded
35 * inputLen: the length of the input buffer, in bytes
36 * Return value:
37 * Returns the length of the decoded string
38 * Requirements:
39 * 1. output must not be null or empty
40 * 2. input must not be null
41 * 3. inputLen must be greater than or equal to 0
42 */
43 int base64_decode(char *output, char *input, int inputLen);
44 
45 /* base64_enc_len:
46 * Description:
47 * Returns the length of a base64 encoded string whose decoded
48 * form is inputLen bytes long
49 * Parameters:
50 * inputLen: the length of the decoded string
51 * Return value:
52 * The length of a base64 encoded string whose decoded form
53 * is inputLen bytes long
54 * Requirements:
55 * None
56 */
57 int base64_enc_len(int inputLen);
58 
59 /* base64_dec_len:
60 * Description:
61 * Returns the length of the decoded form of a
62 * base64 encoded string
63 * Parameters:
64 * input: the base64 encoded string to be measured
65 * inputLen: the length of the base64 encoded string
66 * Return value:
67 * Returns the length of the decoded form of a
68 * base64 encoded string
69 * Requirements:
70 * 1. input must not be null
71 * 2. input must be greater than or equal to zero
72 */
73 int base64_dec_len(char *input, int inputLen);
74 
75 #endif // _BASE64_H