table of contents
libwget-base64(3) | Library Functions Manual | libwget-base64(3) |
NAME¶
libwget-base64 - Base64 functions
SYNOPSIS¶
Macros¶
#define WGET_BASE64_URLENCODE 1
Functions¶
bool wget_base64_is_string (const char *src)
size_t wget_base64_decode (char *dst, const char *src, size_t n)
char * wget_base64_decode_alloc (const char *src, size_t n, size_t
*outlen)
size_t wget_base64_encode (char *dst, const char *src, size_t n)
size_t wget_base64_urlencode (char *dst, const char *src, size_t n)
char * wget_base64_encode_alloc (const char *src, size_t n)
char * wget_base64_encode_vprintf_alloc (const char *fmt, va_list args)
char * wget_base64_encode_printf_alloc (const char *fmt,...)
size_t wget_base64_get_decoded_length (size_t len)
size_t wget_base64_get_encoded_length (size_t len)
Detailed Description¶
This is a collection base64 encoding/decoding functions used in Wget2.
Function Documentation¶
bool wget_base64_is_string (const char * src)¶
Parameters
Returns
Checks whether src is a base64 string. Returns 0 if src is NULL.
size_t wget_base64_decode (char * dst, const char * src, size_t n)¶
Parameters
src Base64 string to be decoded
n Length of src
Returns
Decodes n bytes of the base64 string src. The decoded bytes are written into dst and are 0-terminated.
The size of dst has to be at minimum ((n + 3) / 4) * 3 + 1 bytes.
char * wget_base64_decode_alloc (const char * src, size_t n, size_t * outlen)¶
Parameters
n Length of src
outlen Length of returned string, may be NULL.
Returns
Decodes n bytes of the base64 string src. The decoded bytes are returned in an allocated buffer.
You should free() the returned string when not needed any more.
size_t wget_base64_encode (char * dst, const char * src, size_t n)¶
Parameters
src Input buffer
n Number of bytes to be encoded
Returns
Encodes n bytes from src into a base64 string. The encoded string is written into dst (0-terminated).
The length of dst has to be at minimum ((n + 2) / 3) * 4 + 1 bytes.
size_t wget_base64_urlencode (char * dst, const char * src, size_t n)¶
Parameters
src Input buffer
n Number of bytes to be encoded
Returns
Encodes n bytes from src into a base64 URL and filename safe string (see RFC 4648, 5.). The encoded string is written into dst (0-terminated).
The length of dst has to be at minimum ((n + 2) / 3) * 4 + 1 bytes.
char * wget_base64_encode_alloc (const char * src, size_t n)¶
Parameters
n Number of bytes to be encoded
Returns
Encodes n bytes from input buffer src. The encoded string is returned in an allocated buffer.
You should free() the returned string when not needed any more.
char * wget_base64_encode_vprintf_alloc (const char * fmt, va_list args)¶
Parameters
args Argument list
Returns
Encodes the string constructed by fmt and args. The encoded string is returned in an allocated buffer.
You should free() the returned string when not needed any more.
char * wget_base64_encode_printf_alloc (const char * fmt, ...)¶
Parameters
... Argument list
Returns
Encodes the string constructed by fmt and the arguments. The encoded string is returned in an allocated buffer.
You should free() the returned string when not needed any more.
static inline size_t wget_base64_get_decoded_length (size_t len)¶
Parameters
Returns
Calculate the number of bytes needed for decoding a base64 sequence with length len.
static inline size_t wget_base64_get_encoded_length (size_t len)¶
Parameters
Returns
Calculate the number of bytes needed for base64 encoding a byte sequence with length len, including the padding and 0-termination bytes.
Author¶
Generated automatically by Doxygen for wget2 from the source code.
Version 2.1.0 | wget2 |