NAME
base64_fmt, base64_scan - base64 encode/decode a byte array
SYNOPSIS
#include <limb/base64.h>
size_t base64_fmt(char *dst, const void *data, size_t dlen, int strict) ssize_t base64_scan(char *dst, const char *data, size_t dlen, int strict)
DESCRIPTION
The base64_fmt
() function will encode the byte array pointed to by data
of
length dlen
bytes into the byte array pointed to by dst
using the base64
algorithm as described in RFC 4648, unless strict
is zero in which
case when padding is needed, only one padding character is used.
Refer to base_fmt(3) for more details.
The base64_scan
() function will decode the byte array pointed to by data
of
length dlen
into the byte array pointed to be dst
using the base64 algorithm
as described in RFC 4648, unless strict
is zero if which case it
accepts a single padding character to indicate padding.
Refer to base_scan(3) for more details.
RETURN VALUE
The base64_fmt
() function return the length written into dst
- or that
would have been when dst
is NULL.
The base64_scan
() function return the length written into dst
- or that
would have been when dst
is NULL - on success. Otherwise it returns -1 and
sets errno
to indicate the error.
ERRORS
The base64_scan
() function may fail for any of the errors described for
base_scan(3) except ERANGE.