From df56d2eb26b34b0af590f3aedfda7896f4b103dd Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 19 Oct 2025 00:08:11 +0200 Subject: base64: Add new module Encodes and decodes base64. No linebreaks, always padding. --- src/base64.hh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/base64.hh (limited to 'src/base64.hh') diff --git a/src/base64.hh b/src/base64.hh new file mode 100644 index 0000000..491755c --- /dev/null +++ b/src/base64.hh @@ -0,0 +1,25 @@ +#ifndef BASE64_HH +#define BASE64_HH + +#include +#include +#include +#include +#include + +namespace base64 { + +[[nodiscard]] +std::string encode(std::span data); + +void encode(std::span in, std::string& out); + +[[nodiscard]] +std::optional> decode(std::string_view value); + +[[nodiscard]] +bool decode(std::string_view in, std::vector& out); + +} // namespace base64 + +#endif // BASE64_HH -- cgit v1.2.3-70-g09d2