blob: 2341ab554c6a96cc95c29080204a8b9758a7ba16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
//Chris Xiong 2022
//License: MPL-2.0
#include <cstdint>
#include <string>
class base64_encoder
{
private:
static const char *b64c;
uint8_t counter;
uint8_t rem;
std::string ret;
public:
base64_encoder();
void encode_data(const void *data, size_t len);
std::string finalize();
};
class base64_decoder
{
private:
static const uint8_t b64v[];
size_t dlen;
bool invalid;
uint8_t rem;
uint8_t counter;
size_t bp;
std::string s;
public:
base64_decoder(std::string &&b);
size_t decoded_length();
size_t decode_data(const void *data, size_t len);
};
|