21 static const char* encoding =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
22 if (value_in > 63)
return '=';
23 return encoding[(int)value_in];
28 const char* plainchar = plaintext_in;
29 const char*
const plaintextend = plaintext_in + length_in;
30 char* codechar = code_out;
36 switch (state_in->
step)
41 if (plainchar == plaintextend)
45 return codechar - code_out;
47 fragment = *plainchar++;
48 result = (fragment & 0x0fc) >> 2;
50 result = (fragment & 0x003) << 4;
53 if (plainchar == plaintextend)
57 return codechar - code_out;
59 fragment = *plainchar++;
60 result |= (fragment & 0x0f0) >> 4;
62 result = (fragment & 0x00f) << 2;
65 if (plainchar == plaintextend)
69 return codechar - code_out;
71 fragment = *plainchar++;
72 result |= (fragment & 0x0c0) >> 6;
74 result = (fragment & 0x03f) >> 0;
86 return codechar - code_out;
91 char* codechar = code_out;
93 switch (state_in->
step)
109 return codechar - code_out;
int base64_encode_blockend(char *code_out, base64_encodestate *state_in)
char base64_encode_value(char value_in)
void base64_init_encodestate(base64_encodestate *state_in)
int base64_encode_block(const char *plaintext_in, int length_in, char *code_out, base64_encodestate *state_in)