38 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
43 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
49 unsigned long i,
x = 0;
51 for(i = 0, s = src; i < 4; i++, s++) {
61 while(*p && (*p != *s)) {
101 unsigned char **outptr,
size_t *outlen)
110 unsigned char *newstr;
114 srclen = strlen(src);
117 if(!srclen || srclen % 4)
121 while((src[length] !=
'=') && src[length])
125 if(src[length] ==
'=') {
127 if(src[length + 1] ==
'=')
132 if(length + padding != srclen)
136 numQuantums = srclen / 4;
139 rawlen = (numQuantums * 3) - padding;
142 newstr =
malloc(rawlen + 1);
149 for(i = 0; i < numQuantums; i++) {
173 const char *inputbuff,
size_t insize,
174 char **outptr,
size_t *outlen)
177 unsigned char ibuf[3];
178 unsigned char obuf[4];
183 char *convbuf = NULL;
185 const char *
indata = inputbuff;
191 insize = strlen(indata);
193 #if SIZEOF_SIZE_T == 4 194 if(insize > UINT_MAX/4)
198 base64data = output =
malloc(insize * 4 / 3 + 4);
214 indata = (
char *)convbuf;
217 for(i = inputparts = 0; i < 3; i++) {
220 ibuf[
i] = (
unsigned char) *indata;
228 obuf[0] = (
unsigned char) ((ibuf[0] & 0xFC) >> 2);
229 obuf[1] = (
unsigned char) (((ibuf[0] & 0x03) << 4) | \
230 ((ibuf[1] & 0xF0) >> 4));
231 obuf[2] = (
unsigned char) (((ibuf[1] & 0x0F) << 2) | \
232 ((ibuf[2] & 0xC0) >> 6));
233 obuf[3] = (
unsigned char) (ibuf[2] & 0x3F);
264 *outptr = base64data;
269 *outlen = strlen(base64data);
292 const char *inputbuff,
size_t insize,
293 char **outptr,
size_t *outlen)
316 const char *inputbuff,
size_t insize,
317 char **outptr,
size_t *outlen)
CURLcode Curl_convert_clone(struct Curl_easy *data, const char *indata, size_t insize, char **outbuf)
CURLcode Curl_base64_decode(const char *src, unsigned char **outptr, size_t *outlen)
unsigned char curlx_ultouc(unsigned long ulnum)
CURLcode Curl_base64_encode(struct Curl_easy *data, const char *inputbuff, size_t insize, char **outptr, size_t *outlen)
UNITTEST_START int result
CURLcode Curl_base64url_encode(struct Curl_easy *data, const char *inputbuff, size_t insize, char **outptr, size_t *outlen)
UNITTEST_START char * output
static struct input indata[NUM_HANDLES]
TFSIMD_FORCE_INLINE const tfScalar & x() const
static const char base64url[]
static CURLcode base64_encode(const char *table64, struct Curl_easy *data, const char *inputbuff, size_t insize, char **outptr, size_t *outlen)
static size_t decodeQuantum(unsigned char *dest, const char *src)
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
static const char base64[]