Conversion to/from base64 encoding. More...
#include <stdio.h>
Go to the source code of this file.
Macros | |
#define | base64val(ch) Index64[(unsigned int) (ch)] |
Functions | |
int | mutt_b64_decode (const char *in, char *out, size_t olen) |
Convert null-terminated base64 string to raw bytes. | |
size_t | mutt_b64_encode (const char *in, size_t inlen, char *out, size_t outlen) |
Convert raw bytes to null-terminated base64 string. | |
int | mutt_b64_buffer_decode (struct Buffer *buf, const char *in) |
Convert null-terminated base64 string to raw bytes. | |
size_t | mutt_b64_buffer_encode (struct Buffer *buf, const char *in, size_t len) |
Convert raw bytes to null-terminated base64 string. | |
Variables | |
const int | Index64 [] |
Lookup table for Base64 encoding characters. | |
Conversion to/from base64 encoding.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file base64.h.
int mutt_b64_decode | ( | const char * | in, |
char * | out, | ||
size_t | olen | ||
) |
Convert null-terminated base64 string to raw bytes.
in | Input buffer for the null-terminated base64-encoded string |
out | Output buffer for the raw bytes |
olen | Length of the output buffer |
num | Success, bytes written |
-1 | Error |
This function performs base64 decoding. The resulting buffer is NOT null-terminated. If the input buffer contains invalid base64 characters, this function returns -1.
Definition at line 135 of file base64.c.
size_t mutt_b64_encode | ( | const char * | in, |
size_t | inlen, | ||
char * | out, | ||
size_t | outlen | ||
) |
Convert raw bytes to null-terminated base64 string.
in | Input buffer for the raw bytes |
inlen | Length of the input buffer |
out | Output buffer for the base64 encoded string |
outlen | Length of the output buffer |
num | Length of the string written to the output buffer |
This function performs base64 encoding. The resulting string is guaranteed to be null-terminated. The number of characters up to the terminating NUL-byte is returned (equivalent to calling strlen() on the output buffer after this function returns).
Definition at line 87 of file base64.c.
int mutt_b64_buffer_decode | ( | struct Buffer * | buf, |
const char * | in | ||
) |
Convert null-terminated base64 string to raw bytes.
buf | Buffer for the result |
in | Input buffer for the null-terminated base64-encoded string |
num | Success, bytes written |
-1 | Error |
Definition at line 216 of file base64.c.
size_t mutt_b64_buffer_encode | ( | struct Buffer * | buf, |
const char * | in, | ||
size_t | len | ||
) |
Convert raw bytes to null-terminated base64 string.
buf | Buffer for the result |
in | Input buffer for the raw bytes |
len | Length of the input buffer |
num | Length of the string written to the output buffer |
Definition at line 198 of file base64.c.
|
extern |
Lookup table for Base64 encoding characters.
Encoding chars: