00001 /* Base64 encoding and decoding. 00002 * by Galt Barber */ 00003 00004 #ifndef BASE64_H 00005 #define BASE64_H 00006 00007 #define B64CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 00008 00009 char *base64Encode(char *input, size_t inplen); 00010 /* Use base64 to encode a string. Returns one long encoded 00011 * string which need to be freeMem'd. Note: big-endian algorithm. 00012 * For some applications you may need to break the base64 output 00013 * of this function into lines no longer than 76 chars. 00014 */ 00015 00016 boolean base64Validate(char *input); 00017 /* Return true if input is valid base64. 00018 * Note that the input string is changed by 00019 * eraseWhiteSpace(). */ 00020 00021 char *base64Decode(char *input, size_t *returnSize); 00022 /* Use base64 to decode a string. Return decoded 00023 * string which will be freeMem'd. Note: big-endian algorithm. 00024 * Call eraseWhiteSpace() and check for invalid input 00025 * before passing in input if needed. 00026 * Optionally set retun size for use with binary data. 00027 */ 00028 00029 #endif /* BASE64_H */ 00030
1.5.2