xrpld
Loading...
Searching...
No Matches
xrpl::base64 Namespace Reference

Functions

constexpr std::size_t encodedSize (std::size_t const nBytes)
 Returns the maximum number of characters needed to base64-encode nBytes bytes.
constexpr std::size_t decodedSize (std::size_t const numChars)
 Returns the maximum number of bytes a base64 string of numChars characters decodes to.
char const * getAlphabet ()
signed char const * getInverse ()
std::size_t encode (void *dest, void const *src, std::size_t len)
 Encode a series of octets as a padded, base64 string.
std::pair< std::size_t, std::size_tdecode (void *dest, char const *src, std::size_t len)
 Decode a padded base64 string into a series of octets.

Function Documentation

◆ encodedSize()

std::size_t xrpl::base64::encodedSize ( std::size_t const nBytes)
constexpr

Returns the maximum number of characters needed to base64-encode nBytes bytes.

Parameters
nBytesNumber of input bytes.
Returns
Size of the encoded string, including padding.

Definition at line 53 of file base64.h.

◆ decodedSize()

std::size_t xrpl::base64::decodedSize ( std::size_t const numChars)
constexpr

Returns the maximum number of bytes a base64 string of numChars characters decodes to.

Parameters
numCharsNumber of base64 characters.
Returns
Upper bound on the number of decoded bytes.

Definition at line 66 of file base64.h.

◆ getAlphabet()

char const * xrpl::base64::getAlphabet ( )

Definition at line 48 of file libxrpl/basics/base64.cpp.

◆ getInverse()

signed char const * xrpl::base64::getInverse ( )

Definition at line 56 of file libxrpl/basics/base64.cpp.

◆ encode()

std::size_t xrpl::base64::encode ( void * dest,
void const * src,
std::size_t len )

Encode a series of octets as a padded, base64 string.

The resulting string will not be null terminated.

Requires

The memory pointed to by out points to valid memory of at least encoded_size(len) bytes.

Returns
The number of characters written to out. This will exclude any null termination.

Definition at line 93 of file libxrpl/basics/base64.cpp.

◆ decode()

std::pair< std::size_t, std::size_t > xrpl::base64::decode ( void * dest,
char const * src,
std::size_t len )

Decode a padded base64 string into a series of octets.

Requires

The memory pointed to by out points to valid memory of at least decoded_size(len) bytes.

Returns
The number of octets written to out, and the number of characters read from the input string, expressed as a pair.

Definition at line 145 of file libxrpl/basics/base64.cpp.