Giter Club home page Giter Club logo

base's Introduction

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.