class EE::System::Base64

Overview

#include <base64.hpp>

class Base64 {
public:
    // methods

    static size_t encode(size_t in_len, const unsigned char* in, size_t out_len, char* out);
    static size_t decode(size_t in_len, const char* in, size_t out_len, unsigned char* out);
    static bool encode(std::string_view in, std::string& out);
    static size_t decode(std::string_view in, std::string& out);
    static size_t encodeSafeOutLen(size_t in_len);
    static size_t decodeSafeOutLen(size_t in_len);
};

Detailed Documentation

Methods

static size_t encode(size_t in_len, const unsigned char* in, size_t out_len, char* out)

Encode binary data into base64 digits with MIME style === pads

Returns:

The final length of the output

static size_t decode(size_t in_len, const char* in, size_t out_len, unsigned char* out)

Decode base64 digits with MIME style === pads into binary data

Returns:

The final length of the output

static bool encode(std::string_view in, std::string& out)

Encodes a string into a base64 string

Returns:

True if encoding was successful

static size_t decode(std::string_view in, std::string& out)

Decodes a base64 string to a string

Returns:

True if encoding was successful

static size_t encodeSafeOutLen(size_t in_len)

Returns:

A safe encoding output length for an input of the length indicated

static size_t decodeSafeOutLen(size_t in_len)

Returns:

A safe decoding output length for an input of the length indicated