53 unsigned char char_array_3[3];
54 unsigned char char_array_4[4];
57 char_array_3[i++] = *(bytes_to_encode++);
59 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
60 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
61 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
62 char_array_4[3] = char_array_3[2] & 0x3f;
64 for(i = 0; (i <4) ; i++)
65 ret += b64_chars[char_array_4[i]];
72 for(
j = i;
j < 3;
j++)
73 char_array_3[
j] =
'\0';
75 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
76 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
77 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
78 char_array_4[3] = char_array_3[2] & 0x3f;
80 for (
j = 0; (
j < i + 1);
j++)
81 ret += b64_chars[char_array_4[
j]];
111 int in_len = encoded_string.size();
115 unsigned char char_array_4[4], char_array_3[3];
118 while (
in_len-- && encoded_string[in_] !=
'=') {
119 throw_on_nonbase64(encoded_string[in_], b64_chars);
120 char_array_4[i++] = encoded_string[in_]; in_++;
122 for (i = 0; i <4; i++)
123 char_array_4[i] = strchr(b64_chars, char_array_4[i]) - b64_chars;
125 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
126 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
127 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
129 for (i = 0; (i < 3); i++)
130 ret += char_array_3[i];
136 for (
j = i;
j <4;
j++)
139 for (
j = 0;
j <4;
j++)
140 char_array_4[
j] = strchr(b64_chars, char_array_4[
j]) - b64_chars;
142 char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
143 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
144 char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
146 for (
j = 0; (
j < i - 1);
j++)
ret += char_array_3[
j];