|
Qsmtp
0.30dev
|
Base64 encoding and decoding functions. More...
#include <base64.h>#include <sstring.h>#include <assert.h>#include <stdlib.h>#include <string.h>#include <unistd.h>Macros | |
| #define | B64PAD ((char) '=') |
Functions | |
| int | b64decode (const char *in, size_t l, string *out) |
| int | b64encode (const string *in, string *out, const unsigned int wraplimit) |
Variables | |
| static const char * | b64alpha |
Base64 encoding and decoding functions.
| int b64decode | ( | const char * | in, |
| size_t | l, | ||
| string * | out | ||
| ) |
decode base64 string to plain text
| in | base64 text |
| l | length of in |
| out | string to store decoded string (memory will be malloced) |
| <0 | negative error code |
| 0 | on success |
| 1 | on parse error |
The contents of out are undefined as long as something else than 0 is returned, i.e. the memory is freed but the freed pointer may still be recorded in out.
A final 0-byte will always be added to out->s, which is not counted in out->len.
encode plain text string to Base64
| in | plain text string |
| out | string to store Base64 string (memory will be malloced) |
| wraplimit | the number of characters after which a CRLF pair should be inserted |
| 0 | on success |
| <0 | negative error code |
|
static |
1.8.10