summaryrefslogtreecommitdiff
path: root/includes/Base64.h
blob: 8d0b71dff402a060961fd5b0892f754897f7353e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

#include <Exceptions.h>

namespace Balau {

class Base64 {
public:
    static String encode(const uint8_t * data, int len);
    static int decode(const String & str_in, uint8_t * data_out, size_t outLen = static_cast<size_t>(-1));
    static const double ratio;

private:
    static void encode_block(unsigned char in_tab[3], int len, char out[4]);
    static int stri(char);
    static int decode_block(char s1, char s2, char s3, char s4, unsigned char * out_tab);
};

};