aboutsummaryrefslogtreecommitdiff
path: root/xsig/src/base64.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-18 01:52:26 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-18 01:52:26 -0400
commit4401f681d33f534a7d7ef8f4f940bd54b60710c3 (patch)
treed393f5fa9b5c7e96eae94e3986c40f9d80777818 /xsig/src/base64.hpp
parentf02cb7bf4978ec0fa1eea4ed0b21460b7637d741 (diff)
downloaddeduper-4401f681d33f534a7d7ef8f4f940bd54b60710c3.tar.xz
Move stuff around to accommodate new family members.
Diffstat (limited to 'xsig/src/base64.hpp')
-rw-r--r--xsig/src/base64.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/xsig/src/base64.hpp b/xsig/src/base64.hpp
new file mode 100644
index 0000000..70d4e40
--- /dev/null
+++ b/xsig/src/base64.hpp
@@ -0,0 +1,33 @@
+//Chris Xiong 2022
+//License: MPL-2.0
+#include <cstdint>
+#include <string>
+
+class Base64Encoder
+{
+private:
+ static const char *b64c;
+ uint8_t counter;
+ uint8_t rem;
+ std::string ret;
+public:
+ Base64Encoder();
+ void encode_data(const void *data, size_t len);
+ std::string finalize();
+};
+
+class Base64Decoder
+{
+private:
+ static const uint8_t b64v[];
+ size_t dlen;
+ bool invalid;
+ uint8_t rem;
+ uint8_t counter;
+ size_t bp;
+ std::string s;
+public:
+ Base64Decoder(std::string &&b);
+ size_t decoded_length();
+ size_t decode_data(const void *data, size_t len);
+};