30 out[0] = (in[0] >> 2);
31 out[1] = (((in[0] & 0x03) << 4) | (in[1] >> 4));
32 out[2] = (((in[1] & 0x0f) << 2) | (in[2] >> 6));
33 out[3] = (in[2] & 0x3f);
53 out[0] = (in[0] << 2 | in[1] >> 4);
54 out[1] = (in[1] << 4 | in[2] >> 2);
55 out[2] = (in[2] << 6 | in[3]);
64 void GKEncodeBase64(
int nbytes,
unsigned char *inbuffer,
unsigned char *outbuffer)
69 gk_errexit(
SIGERR,
"GKEncodeBase64: Input buffer size should be a multiple of 3! (%d)\n", nbytes);
71 for (j=0, i=0; i<nbytes; i+=3, j+=4)
85 void GKDecodeBase64(
int nbytes,
unsigned char *inbuffer,
unsigned char *outbuffer)
90 gk_errexit(
SIGERR,
"GKDecodeBase64: Input buffer size should be a multiple of 4! (%d)\n", nbytes);
92 for (j=0, i=0; i<nbytes; i+=4, j+=3)
void gk_errexit(int signum, char *f_str,...)
void encodeblock(unsigned char *in, unsigned char *out)
void decodeblock(unsigned char *in, unsigned char *out)
void GKEncodeBase64(int nbytes, unsigned char *inbuffer, unsigned char *outbuffer)
void GKDecodeBase64(int nbytes, unsigned char *inbuffer, unsigned char *outbuffer)