base64.hpp 752 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef BASE64_H
  2. #define BASE64_H
  3. #include <string>
  4. #include <vector>
  5. namespace base64 {
  6. /**
  7. * Decodes base64 encoded strings.
  8. *
  9. * @param val base64 encoded string
  10. *
  11. * @return normal string
  12. */
  13. std::string decode(const std::string &val);
  14. /**
  15. * Decodes base64 encoded strings.
  16. *
  17. * @param val base64 encoded string
  18. *
  19. * @return char vector
  20. */
  21. std::vector<char> decodeVector(const std::string &val);
  22. /**
  23. * Encodes a string to base64.
  24. *
  25. * @param val normal string
  26. *
  27. * @return base64 encoded string
  28. */
  29. std::string encode(const std::string &val);
  30. /**
  31. * Encodes a vector to base64.
  32. *
  33. * @param val char vector
  34. *
  35. * @return base64 encoded string
  36. */
  37. std::string encodeVector(const std::vector<char> &val);
  38. } // namespace base64
  39. #endif