Fledge
An open source edge computing platform for industrial users
base64.h
1 #ifndef _BASE64_H_
2 #define _BASE64_H_
3 #include <cstdint>
4 /*
5  * Fledge Base64 encoding and decoding tables
6  *
7  * Copyright (c) 2021 Dianomic Systems
8  *
9  * Released under the Apache 2.0 Licence
10  *
11  * Author: Mark Riddoch
12  */
13 
14 static const char encodingTable[] = {
15  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
16  'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
17  'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
18  'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
19  'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
20  'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
21  'w', 'x', 'y', 'z', '0', '1', '2', '3',
22  '4', '5', '6', '7', '8', '9', '+', '/'
23 };
24 
25 static const uint8_t decodingTable[] = {
26  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
27  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
28  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
29  52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 0, 64, 64,
30  64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
31  15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
32  64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
33  41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
34  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
35  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
36  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
37  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
38  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
39  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
40  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
41  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
42 };
43 #endif