Skip to content

r-lyeh-archived/base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base

  • Lightweight binary-to-text data de/encoders (C++03).
  • Base64: canonical implementation.
  • Base85: 17% to 08% smaller than Base64, still quotable.
  • Base91: 19% to 10% smaller than Base64, still quotable, JSON, XML and TSV friendly.
  • Base91: Encoded data can be "quoted", splitted with tabs, spaces, linefeeds and carriages.
  • Tiny, self-contained, header-only.
  • ZLIB/LibPNG licensed.

Sample

#include <iostream>
#include <string>
#include "base.hpp"

int main() {
    std::string encoded_64 = base64::encode("Hello world from BASE64! \x1");
    std::string decoded_64 = base64::decode(encoded_64);
    std::cout<< decoded_64 << " <-> " << encoded_64 << std::endl;

    std::string encoded_85 = base85::encode("Hello world from BASE85! \x1");
    std::string decoded_85 = base85::decode(encoded_85);
    std::cout<< decoded_85 << " <-> " << encoded_85 << std::endl;

    std::string encoded_91 = base91::encode("Hello world from BASE91! \x1");
    std::string decoded_91 = base91::decode(encoded_91);
    std::cout<< decoded_91 << " <-> " << encoded_91 << std::endl;
}

Possible output

Hello world from BASE64! ☺ <-> SGVsbG8gd29ybGQgZnJvbSBCQVNFNjQhIAE=
Hello world from BASE85! ☺ <-> nm=QNzY<mxA+]new].*bavnv)ml0dFaoqGy
Hello world from BASE91! ☺ <-> \OwJh\Io2Tv!lE^jpr4JuucSS5V*pBkA

Licenses

Changelog

  • v1.0.2 (2016/04/20): Base85 support (custom Z85); In-place API; Project renamed
  • v1.0.1 (2015/12/07): Update sample
  • v1.0.0 (2014/04/26): Base64 support
  • v0.0.0 (2013/04/12): Initial commit (custom basE91)

About

Base91 / Base85 / Base64 de/encoders (C++03)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages