base64.h 448 B

1234567891011121314151617181920
  1. #ifndef __BASE64_H__
  2. #define __BASE64_H__
  3. enum {BASE64_OK = 0, BASE64_INVALID};
  4. #define BASE64_ENCODE_OUT_SIZE(s) (((s) + 2) / 3 * 4)
  5. #define BASE64_DECODE_OUT_SIZE(s) (((s)) / 4 * 3)
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. int base64_encode(const unsigned char *in, unsigned int inlen, char *out);
  10. int base64_decode(const char *in, unsigned int inlen, unsigned char *out);
  11. #ifdef __cplusplus
  12. } // extern "C"
  13. #endif
  14. #endif // __BASE64_H__