MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MD / b64decode

Function b64decode

lib/rle.cpp:28–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28std::string b64decode(const std::string& in) {
29 std::string out;
30 std::vector<int> T(256, -1);
31 for (int i = 0; i < 64; i++) T[(unsigned char)B64[i]] = i;
32 int val = 0, valb = -8;
33 for (unsigned char c : in) {
34 if (T[c] == -1) break;
35 val = (val << 6) + T[c];
36 valb += 6;
37 if (valb >= 0) {
38 out += (char)((val >> valb) & 0xFF);
39 valb -= 8;
40 }
41 }
42 return out;
43}
44
45// ── RLE on raw bytes ──────────────────────────────────────────
46// Format: each run = [count(1 byte)][value(1 byte)]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected