** encodeblock ** ** encode 3 8-bit binary bytes as 4 '6-bit' characters */
| 23 | ** encode 3 8-bit binary bytes as 4 '6-bit' characters |
| 24 | */ |
| 25 | void encodeblock(unsigned char in[3], unsigned char out[4], int len) { |
| 26 | out[0] = cb64[in[0] >> 2]; |
| 27 | out[1] = cb64[((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4)]; |
| 28 | out[2] = |
| 29 | (unsigned char)(len > 1 ? cb64[((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6)] : '='); |
| 30 | out[3] = (unsigned char)(len > 2 ? cb64[in[2] & 0x3f] : '='); |
| 31 | } |
| 32 | |
| 33 | /* |
| 34 | ** decodeblock |