README.md

Wed, 24 Nov 2021 10:02:57 +0100

author
David Demelier <markand@malikania.fr>
date
Wed, 24 Nov 2021 10:02:57 +0100
changeset 41
86b259a3f272
parent 37
7c10de272d6b
permissions
-rw-r--r--

misc: update documentation

libbase64 -- Base64 encoding and decoding
=========================================

Introduction
------------

Base64 encoding and decoding easily in pure C99.

Features
--------

- base64 encoding,
- base64 decoding (with base64url support),
- no dynamic allocation required,
- only C99 required.
- less than 200 lines of code.

Quick overview
--------------

Encode data. We use -1 to read until end of input string.

	char encoded[128];
	size_t size;

	size = b64_encode("Hello world!", -1, encoded, sizeof (encoded));

Decode data. As with previous example, we use -1 to read until enf of base64
input string.

	char decoded[128];
	size_t size;

	size = b64_decode("ABx=", -1, decoded, sizeof (decoded));

Note: don't discard return value, in contrast to `b64_encode` the output buffer
      isn't NUL terminated as it may contain binary data.

Documentation
-------------

See the `libbase64(3)` manual page.

mercurial