Skip to content
webcpporgPublic

About

Text encodings for C++20 with one encode/decode interface: hex, base32, base58, base64, bech32, percent and armor, constant time for secrets

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

codecs

codecs holds webcpp's one contract for converting bytes and typed values to text and back, and any data through one-shot and stream transformers, for C++20 on every target webcpp has: native (Linux, macOS, Windows with MSVC), wasip2, wasip3 and Emscripten. Over that contract it ships eight formats: hex, base32, z-base-32, base58, base64, bech32, percent-encoding and RFC 7468's armor, every name in webcpp::codecs. It is header-only and builds on webcpp::secure for its secret and constant-time operations.

Every format is a value (codecs::formats::hex), an operation a function of it (codecs::encode(format, bytes)), and where a result goes a token, so that a digest is a text held in place, a key a secret that wipes itself, and a file a stream. Errors are values, and codecs throws nothing of its own. Its page, doc/codecs.adoc, teaches the formats, the tokens and results, secrecy, composition, streams, allocators and how to write a format or a transformer, with a program of example/ for each; its design is the genesis of libraries/codecs in webcpporg/proposals.

Build and test

codecs is built inside the webcpp superproject, where it is the submodule libs/codecs; a program names /webcpp/codecs//codecs, and /webcpp/codecs//percent for percent-encoding:

exe app : app.cpp /webcpp/codecs//codecs ;

From the superproject's root:

./b2 toolset=clang libs/codecs/test libs/codecs/example

Documentation

The library's page is built with ./b2 libs/codecs/doc doc and published with webcpp's documentation, at https://webcpp.org.

Licence

Distributed under the Boost Software License, Version 1.0 (LICENSE_1_0.txt).

base58's public conversion, in include/webcpp/codecs/detail/formats/base58.hpp, follows Bitcoin Core's EncodeBase58 and DecodeBase58 (src/base58.cpp); codecs is BSL-1.0; base58's public conversion derives from Bitcoin Core's, whose MIT notice is LICENSE-BITCOIN.txt.

About

Text encodings for C++20 with one encode/decode interface: hex, base32, base58, base64, bech32, percent and armor, constant time for secrets

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages