class EE::System::Base64

Overview

#include <base64.hpp>

class Base64 {
public:
    // methods

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

Detailed Documentation

Methods

static int 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 int 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(const std::string& in, std::string& out)

Encodes a string into a base64 string

Returns:

True if encoding was successful

static bool decode(const std::string& in, std::string& out)

Decodes a base64 string to a string

Returns:

True if encoding was successful

static int encodeSafeOutLen(size_t in_len)

Returns:

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

static int decodeSafeOutLen(size_t in_len)

Returns:

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