Base64pp
A simple, correct Base64 encoder written in modern C++
Loading...
Searching...
No Matches
Functions
base64pp Namespace Reference

base64pp API namespace More...

Functions

std::string BASE64PP_EXPORT encode (std::span< std::uint8_t const > const input)
 This function will encode a blob of data into a base64 string.
 
std::optional< std::vector< std::uint8_t > > BASE64PP_EXPORT decode (std::string_view const encoded_str)
 Decodes a base64 encoded string, returning an optional blob. If the decoding fails, it returns std::nullopt.
 

Detailed Description

base64pp API namespace

Function Documentation

◆ decode()

std::optional< std::vector< std::uint8_t > > base64pp::decode ( std::string_view const  encoded_str)

Decodes a base64 encoded string, returning an optional blob. If the decoding fails, it returns std::nullopt.

Parameters
encoded_str- the base64 encoded string
Returns
an optional containing a valid blob of data, if decoding was successful. Otherwise, returns std::nullopt
Note
this function accepts unpadded strings, if they are valid otherwise. It rejects odd-sized unpadded strings.

◆ encode()

std::string base64pp::encode ( std::span< std::uint8_t const > const  input)

This function will encode a blob of data into a base64 string.

Parameters
input- a span pointing to a binary blob to encode.
Returns
a base64 string containing the encoded data.