base64.h 624 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * category: [algorithm]
  3. * apply status: framework(xml)
  4. * edit status: not
  5. * build status: windows&linux
  6. * description:
  7. */
  8. #ifndef __BASE64_H__
  9. #define __BASE64_H__
  10. #pragma once
  11. #include "config.h"
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. static __inline int base64_encode_len(int len)
  16. {
  17. return ((len + 2) / 3 * 4) + 1;
  18. }
  19. TOOLKIT_API int base64_encode(char * coded_dst, const char *plain_src, int len_plain_src);
  20. TOOLKIT_API int base64_decode_len(const char * coded_src);
  21. TOOLKIT_API int base64_decode(char * plain_dst, const char *coded_src);
  22. #ifdef __cplusplus
  23. } // extern "C" {
  24. #endif
  25. #endif //__BASE64_H__