diff options
author | Chris Xiong <chirs241097@gmail.com> | 2022-09-11 01:39:29 -0400 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2022-09-11 01:39:29 -0400 |
commit | c41768dbbd50a0055298d5ec6318ae7f1d2e4ab3 (patch) | |
tree | 4fe4ec18a65424998c33c6654456b2551996ae39 /base64.hpp | |
parent | fd2773c2407aa475ba8aa4c8a72c91b83fd99c42 (diff) | |
download | deduper-c41768dbbd50a0055298d5ec6318ae7f1d2e4ab3.tar.xz |
New testdrive using sqlite db as data storage.
Add signature serialization & deserialization.
Only link what we need from OpenCV.
Diffstat (limited to 'base64.hpp')
-rw-r--r-- | base64.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/base64.hpp b/base64.hpp new file mode 100644 index 0000000..3534b75 --- /dev/null +++ b/base64.hpp @@ -0,0 +1,34 @@ +#include <cstdint> +#include <string> + +std::string base64_encode(const void *data, size_t len); +void* base64_decode(const std::string &s, size_t *rel); + +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); +}; |