b64test.c (680B)
1 /* 2 * Copy me if you can. 3 * by 20h 4 * 5 * % make b64test 6 * % ./b64test 7 */ 8 9 #include <unistd.h> 10 #include <stdlib.h> 11 #include <stdio.h> 12 #include <string.h> 13 14 #include "base64.h" 15 16 int 17 main(int argc, char *argv[]) 18 { 19 char *test = "This is a test, involving someone."; 20 char *test2 = "VGhpcy\nBpcyBh IH\tRlc3QsIGludm9 sdmluZyBzb21lb25lLg=="; 21 char *ret; 22 int len; 23 24 printf("Encoding: %s (%d)\n", test, strlen(test)); 25 ret = b64enc(test, strlen(test)); 26 printf("Result: %s (%d)\n", ret, strlen(ret)); 27 free(ret); 28 29 printf("Decoding: %s (%d)\n", test2, strlen(test2)); 30 len = strlen(test2); 31 ret = b64dec(test2, &len); 32 printf("Result: %s (%d)\n", ret, len); 33 free(ret); 34 35 return 0; 36 } 37