|
|
|
@ -470,6 +470,65 @@ void ParseParameters(int argc, char* argv[])
@@ -470,6 +470,65 @@ void ParseParameters(int argc, char* argv[])
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const int decode64_table[256]= |
|
|
|
|
{ |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
|
|
|
|
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, |
|
|
|
|
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, |
|
|
|
|
49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
|
|
|
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
std::string DecodeBase64(const std::string &s) |
|
|
|
|
{ |
|
|
|
|
char buf[1024]; |
|
|
|
|
if(s.length()>512) return ""; |
|
|
|
|
char *optr=buf; |
|
|
|
|
|
|
|
|
|
int dec, mode=0, left=0; |
|
|
|
|
size_t index=0; |
|
|
|
|
for (int i=0; i<s.length(); i++) |
|
|
|
|
{ |
|
|
|
|
dec=decode64_table[s[i]]; |
|
|
|
|
if(dec==-1) break; |
|
|
|
|
switch(mode) |
|
|
|
|
{ |
|
|
|
|
case 0: // we have no bits and get 6
|
|
|
|
|
left = dec; |
|
|
|
|
mode = 1; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 1: // we have 6 bits and keep 4
|
|
|
|
|
*optr++ = (left<<2) | (dec>>4); |
|
|
|
|
left = dec & 15; |
|
|
|
|
mode = 2; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 2: // we have 4 bits and get 6, we keep 2
|
|
|
|
|
*optr++ = (left<<4) | (dec>>2); |
|
|
|
|
left = dec & 3; |
|
|
|
|
mode = 3; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 3: // we have 2 bits and get 6
|
|
|
|
|
*optr++ = (left<<6) | dec; |
|
|
|
|
mode=0; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*optr=0; |
|
|
|
|
return buf; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool WildcardMatch(const char* psz, const char* mask) |
|
|
|
|