2 #ifndef LIBOSMSCOUT_BASE64_H 3 #define LIBOSMSCOUT_BASE64_H 17 constexpr
const char *
Base64Chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
19 static inline std::string
Base64Encode(
const std::vector<char> &in)
27 unsigned char c = (
unsigned char)jj;
36 out.push_back(
Base64Chars[((val << 8) >> (valb + 8)) & 0x3F]);
39 while ((out.size() % 4)!=0) {
46 static inline std::vector<char>
Base64Decode(
const std::string &in)
49 std::vector<char> out;
51 std::vector<int> T(256, -1);
57 if (c ==
' ' || c ==
'\t' || c ==
'\n' || c ==
'\r') {
65 val = (val << 6) + T[c];
68 out.push_back(
char((val >> valb) & 0xFF));
76 #endif //LIBOSMSCOUT_BASE64_H static std::vector< char > Base64Decode(const std::string &in)
Definition: Base64.h:46
constexpr const char * Base64Chars
Definition: Base64.h:17
static std::string Base64Encode(const std::vector< char > &in)
Definition: Base64.h:19