Go to the source code of this file.
|
std::string | base64_decode (std::string const &encoded_string) |
|
std::string | base64_encode (unsigned char const *bytes_to_encode, unsigned int in_len) |
|
static bool | is_base64 (unsigned char c) |
|
std::string base64_decode |
( |
std::string const & |
encoded_string | ) |
|
Definition at line 84 of file PixelBase64.cc.
References base64_chars, i, is_base64(), j, and run_regression::ret.
85 int in_len = encoded_string.size();
89 unsigned char char_array_4[4], char_array_3[3];
92 while (in_len-- && ( encoded_string[in_] !=
'=') &&
is_base64(encoded_string[in_])) {
93 char_array_4[i++] = encoded_string[in_]; in_++;
95 for (i = 0; i <4; i++)
98 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
99 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
100 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
102 for (i = 0; (i < 3); i++)
103 ret += char_array_3[i];
109 for (j = i; j <4; j++)
112 for (j = 0; j <4; j++)
115 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
116 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
117 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
119 for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
static const std::string base64_chars
static bool is_base64(unsigned char c)
std::string base64_encode |
( |
unsigned char const * |
bytes_to_encode, |
|
|
unsigned int |
in_len |
|
) |
| |
Definition at line 41 of file PixelBase64.cc.
References base64_chars, i, j, and run_regression::ret.
Referenced by base64_encode_alloc(), pos::PixelConfigBase::getComment(), pos::PixelROCMaskBits::writeXML(), and pos::PixelROCTrimBits::writeXML().
45 unsigned char char_array_3[3];
46 unsigned char char_array_4[4];
49 char_array_3[i++] = *(bytes_to_encode++);
51 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
52 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
53 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
54 char_array_4[3] = char_array_3[2] & 0x3f;
56 for(i = 0; (i <4) ; i++)
64 for(j = i; j < 3; j++)
65 char_array_3[j] =
'\0';
67 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
68 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
69 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
70 char_array_4[3] = char_array_3[2] & 0x3f;
72 for (j = 0; (j < i + 1); j++)
static const std::string base64_chars
static bool is_base64 |
( |
unsigned char |
c | ) |
|
|
inlinestatic |
const std::string base64_chars |
|
static |