Skip to content

Commit 8549c9d

Browse files
committed
release 1.1.1.0
1 parent e6fb436 commit 8549c9d

16 files changed

+26096
-206
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ cmake-build-debug/
3636
cmake-build-release/
3737
.vscode
3838
.vs
39-
rithmic_config.toml
39+
rithmic.bin

3rdparty/base64_encode_decode.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//FROM
2+
//https://stackoverflow.com/a/34571089/5155484
3+
4+
#include <string>
5+
#include <vector>
6+
7+
typedef unsigned char uchar;
8+
inline static const std::string b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";//=
9+
10+
inline std::string base64_encode(const std::string &in)
11+
{
12+
std::string out;
13+
14+
int val=0, valb=-6;
15+
for (uchar c : in) {
16+
val = (val<<8) + c;
17+
valb += 8;
18+
while (valb>=0) {
19+
out.push_back(b[(val>>valb)&0x3F]);
20+
valb-=6;
21+
}
22+
}
23+
if (valb>-6) out.push_back(b[((val<<8)>>(valb+8))&0x3F]);
24+
while (out.size()%4) out.push_back('=');
25+
return out;
26+
}
27+
28+
inline std::string base64_decode(const std::string &in)
29+
{
30+
std::string out;
31+
std::vector<int> T(256,-1);
32+
for (int i=0; i<64; i++) T[b[i]] = i;
33+
34+
int val=0, valb=-8;
35+
for (uchar c : in) {
36+
if (T[c] == -1) break;
37+
val = (val<<6) + T[c];
38+
valb += 6;
39+
if (valb>=0) {
40+
out.push_back(char((val>>valb)&0xFF));
41+
valb-=8;
42+
}
43+
}
44+
return out;
45+
}

0 commit comments

Comments
 (0)