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