|
Paraslash Audio Streaming |
About News Download Documentation Development |
Uudecode and base64decode implementation. More...
Macros | |
#define | BASE64_MAX_DECODED_SIZE(_encoded_size) ((_encoded_size) / 4 * 3) |
Maximal possible size of the decoded data. More... | |
#define | PAD64 '=' |
The padding character which is appended to base64 encoded data. More... | |
Functions | |
int | base64_decode (char const *src, size_t encoded_size, char **result, size_t *decoded_size) |
base64-decode a buffer. More... | |
int | uudecode (char const *src, size_t encoded_size, char **result, size_t *decoded_size) |
Decode a buffer using the uuencode Base64 algorithm. More... | |
Uudecode and base64decode implementation.
#define BASE64_MAX_DECODED_SIZE | ( | _encoded_size | ) | ((_encoded_size) / 4 * 3) |
Maximal possible size of the decoded data.
#define PAD64 '=' |
The padding character which is appended to base64 encoded data.
base64 encoded data is always an ascii string whose length is a multiple of four. If the number of characters needed to encode the data is not a multiple of four, the encoded string is padded with this character. The number of pad characters is either 0, 1 or 2, but never 3, and this number is a function of the number of bytes of the unencrypted data modulo 3.
int base64_decode | ( | char const * | src, |
size_t | encoded_size, | ||
char ** | result, | ||
size_t * | decoded_size | ||
) |
base64-decode a buffer.
src | The buffer to decode. |
encoded_size | The special value -1 means: look for terminating zero byte. |
result | Points to dynamically allocated target buffer on success. |
decoded_size | Number 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.
References alloc(), BASE64_MAX_DECODED_SIZE, PAD64, and para_isspace.
Referenced by decode_private_key(), and uudecode().
int uudecode | ( | char const * | src, |
size_t | encoded_size, | ||
char ** | result, | ||
size_t * | decoded_size | ||
) |
Decode a buffer using the uuencode Base64 algorithm.
src | The buffer to decode. |
encoded_size | Number of input bytes in the source buffer. |
result | Contains the decoded data on success. |
decoded_size | Number of output bytes on success. |
This is just a simple wrapper for base64_decode() which strips whitespace.
References base64_decode().