| 1 | #ifndef BASE64_H |
| 2 | #define BASE64_H |
| 3 | |
| 4 | #define BASE64_ENCODE_OUT_SIZE(s) ((unsigned int)((((s) + 2) / 3) * 4 + 1)) |
| 5 | #define BASE64_DECODE_OUT_SIZE(s) ((unsigned int)(((s) / 4) * 3)) |
| 6 | |
| 7 | /* |
| 8 | * out is null-terminated encode string. |
| 9 | * return values is out length, exclusive terminating `\0' |
| 10 | */ |
| 11 | unsigned int |
| 12 | base64_encode(const unsigned char *in, unsigned int inlen, char *out); |
| 13 | |
| 14 | /* |
| 15 | * return values is out length |
| 16 | */ |
| 17 | unsigned int |
| 18 | base64_decode(const char *in, unsigned int inlen, unsigned char *out); |
| 19 | |
| 20 | #endif /* BASE64_H */ |