Synopsis#include <glib.h> gsize g_base64_encode_step (const guchar *in, gsize len, gboolean break_lines, gchar *out, gint *state, gint *save); gsize g_base64_encode_close (gboolean break_lines, gchar *out, gint *state, gint *save); gchar* g_base64_encode (const guchar *data, gsize len); gsize g_base64_decode_step (const gchar *in, gsize len, guchar *out, gint *state, guint *save); guchar* g_base64_decode (const gchar *text, gsize *out_len); DescriptionBase64 is an encoding that allows to encode a sequence of arbitrary bytes as a sequence of printable ASCII characters. For the definition of Base64, see RFC 1421 or RFC 2045. Base64 is most commonly used as a MIME transfer encoding for email.
GLib supports incremental encoding using Support for Base64 encoding has been added in GLib 2.12. Detailsg_base64_encode_step ()gsize g_base64_encode_step (const guchar *in, gsize len, gboolean break_lines, gchar *out, gint *state, gint *save); Incrementally encode a sequence of binary data into it's Base-64 stringified representation. By calling this function multiple times you can convert data in chunks to avoid having to have the full encoded data in memory.
When all of the data has been converted you must call
The output buffer must be large enough to fit all the data that will
be written to it. Due to the way base64 encodes you will need
at least:
Since 2.12 g_base64_encode_close ()gsize g_base64_encode_close (gboolean break_lines, gchar *out, gint *state, gint *save);
Flush the status from a sequence of calls to
Since 2.12 g_base64_encode ()gchar* g_base64_encode (const guchar *data, gsize len); Encode a sequence of binary data into its Base-64 stringified representation.
Since 2.12 g_base64_decode_step ()gsize g_base64_decode_step (const gchar *in, gsize len, guchar *out, gint *state, guint *save); Incrementally decode a sequence of binary data from its Base-64 stringified representation. By calling this function multiple times you can convert data in chunks to avoid having to have the full encoded data in memory.
The output buffer must be large enough to fit all the data that will
be written to it. Since base64 encodes 3 bytes in 4 chars you need
at least:
Since 2.12 g_base64_decode ()guchar* g_base64_decode (const gchar *text, gsize *out_len); Decode a sequence of Base-64 encoded text into binary data
Since 2.12 |