Binary-to-text encoding algorithms implemented in C++
The header-only C++ library implements arbitrary binary data encoding and decoding to a number of ASCII formats in accordance to binary-to-text encoding schemes.
- One-stop implementation for different binary-to-text schemes
- Encoding/Decoding algorithms for both Internet and computer/EEPROM/Flash memory initialization
- Modern realization in C++ language
- Ease of use
- Permissive licensing
- Portability
- Correctness
- Usage simplicity
- Adherence to C++ standards
- Efficiency
The project name is built from words "Decoding" and "Encoding". But, I like to pronounce the name of the project as "decens" - a Latin word meaning "fitting", "appropriate", "worthy", "decent", "well-formed".
The project implements a number of well-known encoding schemes. Due to the "header-only" and "template" nature of the implementation, only those algorithms that used in an application will be part of compiled executable file.
The main class decenc instantiates algorithm passed as a template parameter providing static polymorphism.
#include <decenc/decenc.hpp>
using namespace DECENC; // Use DECENC namespace
...
std::string in("Hello");
std::string out;
...
decenc<base64> coder; // Choose encoding scheme
error err = coder.encode(in, out); // Do encoding
if (!err.is_ok()) ... // Check for errors
...
coder.decode(out, in); // Do decoding
if (!err.is_ok()) ... // Check for errors
...
Scheme | Class Name | Reference |
---|---|---|
Base16 | base16 | - RFC 4648 |
Base32 | base32 | - RFC 4648 |
Base32Hex | base32hex | - RFC 4648 |
Base64 | base64 | - RFC 4648 |
Base64URL | base64url | - RFC 4648 |
Base91 | base91 | - basE91 encoding - A Proposal of Substitute for Base85/64 – Base91 |