Base64.h 605 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _BASE64_H_
  2. #define _BASE64_H_
  3. #include<string>
  4. using namespace std;
  5. //#include <conf.h>
  6. class CBase64Coder
  7. {
  8. private:
  9. static char ch64[];
  10. char* buf;
  11. int size;
  12. private:
  13. static int BinSearch(char p);
  14. int calc_base64_len(int data_len);
  15. int calc_data_len(const char * base64, int base64_len);
  16. char _getBase64Char(char c);
  17. void allocMem(int NewSize);
  18. public:
  19. int GetSize()
  20. {
  21. return size;
  22. }
  23. CBase64Coder();
  24. ~CBase64Coder();
  25. const char* encode(const string& message);
  26. const char* encode(const char* buffer, int buflen);
  27. const char* decode(const char* buffer, int Length);
  28. };
  29. #endif