Created
December 4, 2022 22:29
-
-
Save bagder/baee5725e09a5977ef5b0471e2b3334f to your computer and use it in GitHub Desktop.
base64 emcoding test program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <curl/curl.h> | |
#define F "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\x01\xff" | |
#define F2 F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F | |
#define F3 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 F2 | |
#define F4 F3 F3 | |
int main(void) | |
{ | |
printf("%s\n", curl_version()); | |
CURL *curl; | |
CURLcode res; | |
curl_global_init(CURL_GLOBAL_DEFAULT); | |
curl = curl_easy_init(); | |
if(curl) { | |
size_t max = strlen(F4); /* this ends up 106128 bytes */ | |
size_t i; | |
printf("Max length: %zu\n", max); | |
for(i = 1; i < max; i++ ) { | |
char *out; | |
size_t outlen; | |
Curl_base64_encode(F4, i, &out, &outlen); | |
curl_free(out); | |
} | |
curl_easy_cleanup(curl); | |
} | |
curl_global_cleanup(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment