busybox-1.32.0/networking/httpd.c
static void decodeBase64(char *Data)
{
	const unsigned char *in = (const unsigned char *)Data;
	/* The decoded size will be at most 3/4 the size of the encoded */
	unsigned ch = 0;
	int i = 0;

	while (*in) {
		int t = *in++;

		if (t >= '0' && t <= '9')
			t = t - '0' + 52;
		else if (t >= 'A' && t <= 'Z')
			t = t - 'A';
		else if (t >= 'a' && t <= 'z')
			t = t - 'a' + 26;
		else if (t == '+')
			t = 62;
		else if (t == '/')
			t = 63;
		else if (t == '=')
			t = 0;
		else
			continue;

		ch = (ch << 6) | t;
		i++;
		if (i == 4) {
			*Data++ = (char) (ch >> 16);
			*Data++ = (char) (ch >> 8);
			*Data++ = (char) ch;
			i = 0;
		}
	}
	*Data = '\0';
}
/*
 * Decode a base64 data stream as per rfc1521.
 * Note that the rfc states that non base64 chars are to be ignored.
 * Since the decode always results in a shorter size than the input,
 * it is OK to pass the input arg as an output arg.
 * Parameter: a pointer to a base64 encoded string.
 * Decoded data is stored in-place.
 */
Decode a base64 data stream as per rfc1521.
Note that the rfc states that non base64 chars are to be ignored.
Since the decode always results in a shorter size than the input,
it is OK to pass the input arg as an output arg.
Parameter: a pointer to a base64 encoded string.
Decoded data is stored in-place.
Decode a base64 data stream as per rfc1521 . Note that the rfc states that non base64 chars are to be ignored . Since the decode always results in a shorter size than the input it is OK to pass the input arg as an output arg . Parameter : a pointer to a base64 encoded string . Decoded data is stored in - place .
static void decodeBase64(char *Data)
{
	const unsigned char *in = (const unsigned char *)Data;
	unsigned ch = 0;
	int i = 0;
	while (*in) {
		int t = *in++;
		if (t >= '0' && t <= '9')
			t = t - '0' + 52;
		else if (t >= 'A' && t <= 'Z')
			t = t - 'A';
		else if (t >= 'a' && t <= 'z')
			t = t - 'a' + 26;
		else if (t == '+')
			t = 62;
		else if (t == '/')
			t = 63;
		else if (t == '=')
			t = 0;
		else
			continue;
		ch = (ch << 6) | t;
		i++;
		if (i == 4) {
			*Data++ = (char) (ch >> 16);
			*Data++ = (char) (ch >> 8);
			*Data++ = (char) ch;
			i = 0;
		}
	}
	*Data = '\0';
}
static void decodeBase64 ( char * Data ) { const unsigned char * in = ( const unsigned char * ) Data ; unsigned ch = 0 ; int i = 0 ; while ( * in ) { int t = * in ++ ; if ( t >= ' ' && t <= ' ' ) t = t - ' ' + 52 ; else if ( t >= ' ' && t <= ' ' ) t = t - ' ' ; else if ( t >= ' ' && t <= ' ' ) t = t - ' ' + 26 ; else if ( t == ' ' ) t = 62 ; else if ( t == ' ' ) t = 63 ; else if ( t == ' ' ) t = 0 ; else continue ; ch = ( ch << 6 ) | t ; i ++ ; if ( i == 4 ) { * Data ++ = ( char ) ( ch >> 16 ) ; * Data ++ = ( char ) ( ch >> 8 ) ; * Data ++ = ( char ) ch ; i = 0 ; } } * Data = ' \0 ' ; }
Decode a base64 data stream as per rfc1521.
Decode a base64 data stream as per rfc1521 .
/* The decoded size will be at most 3/4 the size of the encoded */