#include <string>
Go to the source code of this file.
◆ base64_decode()
std::string base64_decode |
( |
std::string const & |
s | ) |
|
Definition at line 78 of file PixelBase64.cc.
References base64_chars, mps_fire::i, is_base64(), dqmiolumiharvest::j, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.
79 int in_len = encoded_string.size();
83 unsigned char char_array_4[4], char_array_3[3];
86 while (in_len-- && (encoded_string[in_] !=
'=') &&
is_base64(encoded_string[in_])) {
87 char_array_4[
i++] = encoded_string[in_];
90 for (
i = 0;
i < 4;
i++)
93 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
94 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
95 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
97 for (
i = 0; (
i < 3);
i++)
98 ret += char_array_3[
i];
104 for (
j =
i;
j < 4;
j++)
107 for (
j = 0;
j < 4;
j++)
110 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
111 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
112 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
114 for (
j = 0; (
j <
i - 1);
j++)
115 ret += char_array_3[
j];
ret
prodAgent to be discontinued
static const std::string base64_chars
static bool is_base64(unsigned char c)
◆ base64_encode()
std::string base64_encode |
( |
unsigned char const * |
, |
|
|
unsigned int |
len |
|
) |
| |
Definition at line 38 of file PixelBase64.cc.
References base64_chars, mps_fire::i, dqmiolumiharvest::j, runTheMatrix::ret, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by pos::PixelConfigBase::getComment(), pos::PixelROCMaskBits::writeXML(), and pos::PixelROCTrimBits::writeXML().
42 unsigned char char_array_3[3];
43 unsigned char char_array_4[4];
46 char_array_3[
i++] = *(bytes_to_encode++);
48 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
49 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
50 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
51 char_array_4[3] = char_array_3[2] & 0x3f;
53 for (
i = 0; (
i < 4);
i++)
60 for (
j =
i;
j < 3;
j++)
61 char_array_3[
j] =
'\0';
63 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
64 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
65 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
66 char_array_4[3] = char_array_3[2] & 0x3f;
68 for (
j = 0; (
j <
i + 1);
j++)
ret
prodAgent to be discontinued
static const std::string base64_chars