paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Functions
base64.h File Reference

uudecode/base64 API. More...

Functions

int uudecode (char const *src, size_t encoded_size, char **result, size_t *decoded_size)
 Decode a buffer using the uuencode Base64 algorithm. More...
 
int base64_decode (char const *src, size_t encoded_size, char **result, size_t *decoded_size)
 base64-decode a buffer. More...
 

Detailed Description

uudecode/base64 API.

Function Documentation

◆ uudecode()

int uudecode ( char const *  src,
size_t  encoded_size,
char **  result,
size_t *  decoded_size 
)

Decode a buffer using the uuencode Base64 algorithm.

Parameters
srcThe buffer to decode.
encoded_sizeNumber of input bytes in the source buffer.
resultContains the decoded data on success.
decoded_sizeNumber of output bytes on success.

This is just a simple wrapper for base64_decode() which strips whitespace.

Returns
The return value of the underlying call to base64_decode().
See also
uuencode(1), uudecode(1).

References base64_decode().

◆ base64_decode()

int base64_decode ( char const *  src,
size_t  encoded_size,
char **  result,
size_t *  decoded_size 
)

base64-decode a buffer.

Parameters
srcThe buffer to decode.
encoded_sizeThe special value -1 means: look for terminating zero byte.
resultPoints to dynamically allocated target buffer on success.
decoded_sizeNumber of bytes written to result.

Skips all whitespace anywhere. Converts characters, four at a time, starting at (or after) src from base - 64 numbers into three 8 bit bytes in the target area.

It is OK to pass a NULL pointer as decoded_size. The result is terminated with a zero byte.

Returns
Standard. The contents of result and decoded_size are undefined on failure.

References alloc(), BASE64_MAX_DECODED_SIZE, PAD64, and para_isspace.

Referenced by decode_private_key(), and uudecode().