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

base32.h File Reference


Detailed Description

Base32 encoding/decoding.

Author:
Raphael Manfredi
Date:
2002-2003

#include <glib.h>

Go to the source code of this file.

Functions

gchar * base32_encode (const gchar *buf, gint len, gint *retpad, gboolean padding)
 Encode `len' bytes starting at `buf' into new allocated buffer.

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

void base32_encode_str_into (const gchar *buf, gint len, gchar *encbuf, gint enclen, gboolean padding)
 Encode `len' bytes from `buf' into `enclen' bytes starting from `encbuf'.

gchar * base32_decode (const gchar *buf, gint len, gint *outbuf)
 Decode `len' bytes starting at `buf' into new allocated buffer.

gint base32_decode_into (const gchar *buf, gint len, gchar *decbuf, gint declen)
 Decode `len' bytes from `buf' into `declen' bytes starting from `decbuf', faking the necessary amount of padding if necessary.

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


Function Documentation

gchar* base32_decode const gchar *  buf,
gint  len,
gint *  outlen
 

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

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

gint base32_decode_into const gchar *  buf,
gint  len,
gchar *  decbuf,
gint  declen
 

Decode `len' bytes from `buf' into `declen' bytes starting from `decbuf', faking the necessary amount of padding if necessary.

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 base32.

gint base32_decode_old_into const gchar *  buf,
gint  len,
gchar *  decbuf,
gint  declen
 

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

faking the necessary amount of padding if necessary. Caller must have ensured that there was sufficient room in decbuf. The "old" base32 alphabet is used for decoding.

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

gchar* base32_encode const gchar *  buf,
gint  len,
gint *  retpad,
gboolean  padding
 

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

Trailing padding chars are emitted when `padding' is TRUE.

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

void base32_encode_into const gchar *  buf,
gint  len,
gchar *  encbuf,
gint  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.

void base32_encode_str_into const gchar *  buf,
gint  len,
gchar *  encbuf,
gint  enclen,
gboolean  padding
 

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

Trailing padding chars are emitted when `padding' is TRUE. A trailing NUL is emitted at the end of the encoded buffer. Caller must have ensured that there was enough room in encbuf.


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