README.md

Mon, 07 Jun 2021 21:15:30 +0200

author
David Demelier <markand@malikania.fr>
date
Mon, 07 Jun 2021 21:15:30 +0200
changeset 36
1bf597a532fc
parent 34
e4a6c3f3d0f2
permissions
-rw-r--r--

misc: added signature for changeset 6750b0276186

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

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

Base64 encoding and decoding easily in pure C89.

Features
--------

- base64 encoding,
- base64 decoding (with base64url support),
- no dynamic allocation required,
- only C89 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: even with binary data the function `b64_decode` still append a NUL
terminator. Use the return code from the function to get the size binary data.

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

See the libbase64(3) manual page.

	man ./libbase64.3

mercurial