Orcania
Potluck with different functions for different purposes that can be shared among C programs
Functions
Base64 encode and decode functions

Functions

int o_base64_encode (const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
 
int o_base64_decode (const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
 
int o_base64url_encode (const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
 
int o_base64url_decode (const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
 
int o_base64url_2_base64 (const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
 
int o_base64_2_base64url (const unsigned char *src, size_t len, unsigned char *out, size_t *out_len)
 

Detailed Description

Function Documentation

◆ o_base64_encode()

int o_base64_encode ( const unsigned char *  src,
size_t  len,
unsigned char *  out,
size_t *  out_len 
)

o_base64_encode - Base64 encode

Parameters
srcData to be encoded
lenLength of the data to be encoded
outPointer to output variable
out_lenPointer to output length variable
Returns
: 1 on success, 0 on failure

The nul terminator is not included in out_len.

o_base64_encode - Base64 encode @src: Data to be encoded @len: Length of the data to be encoded @out: Pointer to output variable @out_len: Pointer to output length variable Returns: 1 on success, 0 on failure

The nul terminator is not included in out_len.

◆ o_base64_decode()

int o_base64_decode ( const unsigned char *  src,
size_t  len,
unsigned char *  out,
size_t *  out_len 
)

o_base64_decode - Base64 decode

Parameters
srcData to be decoded
lenLength of the data to be decoded
outPointer to output variable
out_lenPointer to output length variable
Returns
: 1 on success, 0 on failure

The nul terminator is not included in out_len.

o_base64_decode - Base64 decode @src: Data to be decoded @len: Length of the data to be decoded @out: Pointer to output variable @out_len: Pointer to output length variable Returns: 1 on success, 0 on failure

The nul terminator is not included in out_len.

◆ o_base64url_encode()

int o_base64url_encode ( const unsigned char *  src,
size_t  len,
unsigned char *  out,
size_t *  out_len 
)

o_base64url_encode - Base64url encode (url format)

Parameters
srcData to be encoded
lenLength of the data to be encoded
outPointer to output variable
out_lenPointer to output length variable
Returns
: 1 on success, 0 on failure

The nul terminator is not included in out_len.

o_base64url_encode - Base64url encode (url format) @src: Data to be encoded @len: Length of the data to be encoded @out: Pointer to output variable @out_len: Pointer to output length variable Returns: 1 on success, 0 on failure

The nul terminator is not included in out_len.

◆ o_base64url_decode()

int o_base64url_decode ( const unsigned char *  src,
size_t  len,
unsigned char *  out,
size_t *  out_len 
)

o_base64url_decode - Base64 decode (url format)

Parameters
srcData to be decoded
lenLength of the data to be decoded
outPointer to output variable
out_lenPointer to output length variable
Returns
: 1 on success, 0 on failure

The nul terminator is not included in out_len.

o_base64url_decode - Base64 decode (url format) @src: Data to be decoded @len: Length of the data to be decoded @out: Pointer to output variable @out_len: Pointer to output length variable Returns: 1 on success, 0 on failure

The nul terminator is not included in out_len.

◆ o_base64url_2_base64()

int o_base64url_2_base64 ( const unsigned char *  src,
size_t  len,
unsigned char *  out,
size_t *  out_len 
)

o_base64url_2_base64 - Convert a base64 url format to base64 format

Parameters
srcData to be decoded
lenLength of the data to be decoded
outPointer to output variable
out_lenPointer to output length variable
Returns
: 1 on success, 0 on failure

The nul terminator is not included in out_len. out must be at least len+2

o_base64url_2_base64 - Convert a base64 url format to base64 format @src: Data to be decoded @len: Length of the data to be decoded @out: Pointer to output variable @out_len: Pointer to output length variable Returns: 1 on success, 0 on failure

The nul terminator is not included in out_len. out must be at least len+2

◆ o_base64_2_base64url()

int o_base64_2_base64url ( const unsigned char *  src,
size_t  len,
unsigned char *  out,
size_t *  out_len 
)

o_base64url_2_base64 - Convert a base64 format to base64 url format

Parameters
srcData to be decoded
lenLength of the data to be decoded
outPointer to output variable
out_lenPointer to output length variable
Returns
: 1 on success, 0 on failure

The nul terminator is not included in out_len. out must be at least len+2

o_base64url_2_base64 - Convert a base64 format to base64 url format @src: Data to be decoded @len: Length of the data to be decoded @out: Pointer to output variable @out_len: Pointer to output length variable Returns: 1 on success, 0 on failure

The nul terminator is not included in out_len. out must be at least len+2