Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.3 KiB

.TH scan_base64 3
scan_base64 \- decode base64 encoded data
.B #include <textcode.h>
size_t \fBscan_base64\fP(const char *\fIsrc\fR,char *\fIdest\fR,size_t* \fIdestlen\fR);
scan_base64 decodes base64 encoded data from src into dest.
It will stop when it encountes any non-valid input characters.
It will then write the number of decoded bytes in dest into *destlen,
and return the number of bytes decoded from src.
Note that real world base64 encoded data is sometimes permitted to
contain whitespace characters or new lines. This function will not allow
those and return the decoded data until then.
base64 works by taking 3 bytes of binary input and converting them into
4 bytes of printable ASCII. If the input ends in the middle of a base64
4-byte-tuple, scan_base64 will disregard the whole tuple.
Many base64 variants demand padding in the last block. Some don't. This
implementation will consume padding if it is there, but will not
complain if it is not.
dest can be NULL. destlen can be NULL.
scan_base64 returns the number of bytes successfully scanned and
processed from src.
scan_base64("%9FYO<F0`",buf,&i) -> return 8, i=5, buf="fnord"
scan_xlong(3), scan_8long(3), fmt_ulong(3)