Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

base64.h File Reference


Detailed Description

Base64 encoding/decoding.

Author:
Raphael Manfredi
Date:
2003

#include <glib.h>

Go to the source code of this file.

Functions

gchar * base64_encode (const gchar *buf, guint len, guint *retpad)
 Encode `len' bytes starting at `buf' into new allocated buffer.

void base64_encode_into (const gchar *buf, guint len, gchar *encbuf, guint enclen)
 Encode `len' bytes from `buf' into `enclen' bytes starting from `encbuf'.

gchar * base64_decode (const gchar *buf, guint len, guint *outlen)
 Decode `len' bytes starting at `buf' into new allocated buffer.

guint base64_decode_into (const gchar *buf, guint len, gchar *decbuf, guint declen)
 Decode `len' bytes from `buf' into `declen' bytes starting from `decbuf'.


Function Documentation

gchar* base64_decode const gchar *  buf,
guint  len,
guint *  outlen
 

Decode `len' bytes starting at `buf' into new allocated buffer.

Returns:
the new decoded buffer, or NULL if the input was not valid base64 encoding. The caller knows the length of the returned buffer: it's the size of the input divided by 4 and multiplied by 3. If `outlen' is non-NULL, it is filled with the amount of bytes decoded into the buffer (without trailing padding).

guint base64_decode_into const gchar *  buf,
guint  len,
gchar *  decbuf,
guint  declen
 

Decode `len' bytes from `buf' into `declen' bytes starting from `decbuf'.

Caller must have ensured that there was sufficient room in decbuf.

Returns:
the amount of bytes decoded (without trailing padding) if successful, 0 if the input was not valid base64.

gchar* base64_encode const gchar *  buf,
guint  len,
guint *  retpad
 

Encode `len' bytes starting at `buf' into new allocated buffer.

Trailing padding chars are emitted.

Returns:
the new encoded buffer, NUL-terminated, and the added amount of padding chars in `retpad' if it is a non-NULL pointer.

void base64_encode_into const gchar *  buf,
guint  len,
gchar *  encbuf,
guint  enclen
 

Encode `len' bytes from `buf' into `enclen' bytes starting from `encbuf'.

Trailing padding chars are emitted. Caller must have ensured that there was enough room in encbuf.

Attention:
NB: No trailing NUL is emitted.


Generated on Sun Feb 12 10:49:59 2006 for Gtk-Gnutella by doxygen 1.3.6