Base module

base64

Base64 encoding and decoding helpers.

base64

Base64 encoding and decoding helpers.

Classes

NameDescription
DecoderBase64 decoder.
EncoderBase64 encoder.

Functions

ReturnNameDescription
size_tencodedBufferCapacity inlineReturns a safe temporary buffer size for encoding up to inputSize bytes. Includes padding/newline slack so callers can reuse the same buffer for finalize().
std::stringencode inlineEncodes an STL byte container to a Base64 string.
std::stringdecode inlineDecodes a Base64-encoded STL container to a binary string.

encodedBufferCapacity

inline

inline size_t encodedBufferCapacity(size_t inputSize, int lineLength)

Returns a safe temporary buffer size for encoding up to inputSize bytes. Includes padding/newline slack so callers can reuse the same buffer for finalize().


encode

inline

template<typename T> inline std::string encode(const T & bytes, int lineLength)

Encodes an STL byte container to a Base64 string.

Parameters

  • T Container type with a size() method and contiguous operator[].

Parameters

  • bytes Input data container.

  • lineLength Characters per line in the output (0 disables wrapping).

Returns

Base64-encoded string.


decode

inline

template<typename T> inline std::string decode(const T & bytes)

Decodes a Base64-encoded STL container to a binary string.

Parameters

  • T Container type with a size() method and contiguous operator[].

Parameters

  • bytes Input Base64 data container.

Returns

Decoded binary string.

Variables

ReturnNameDescription
constexpr intBUFFER_SIZE
constexpr intLINE_LENGTH

BUFFER_SIZE

constexpr int BUFFER_SIZE = 16384

LINE_LENGTH

constexpr int LINE_LENGTH = 72