Skip to content

ikrivosheev/base64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Base64 stream encoder/decoder

API

Encoding

b64_stream_encode_init

struct b64_encode_state 
{
    int phase;
    size_t out_len;
    char buffer[3];
};

void b64_stream_encode_init(struct b64_encode_state *state);

Call this function for init state and befor calling b64_stream_decode()

b64_stream_encode

int b64_stream_encode(
    struct b64_encode_state *state,
    const char* str,
    size_t src_len,
    char* out
);

b64_stream_encode_final

int b64_stream_encode_final(struct b64_encode_state *state, char* out);

Decoding

b64_stream_decode_init

struct b64_decode_state 
{
    int phase;
    size_t out_len;
    char buffer[4];
};

void b64_stream_decode_init(struct b64_decode_state *state);

b64_stream_decode

int b64_stream_decode(
    struct b64_decode_state *state, 
    const char* src, 
    size_t src_len, 
    char* out
);

b64_stream_decode_final

int b64_stream_decode_final(struct b64_decode_state *state);