Code Monkey home page Code Monkey logo

base16.js's Introduction

Base16.js

Encoding And Decoding Text Using Only 16 Characters

Installation

Base16.js requires installation through npm, so you need to install npm in case it's not already installed.

From your terminal, navigate to your folder project and run the following command:

npm install base16.js

And that's all!

Test

To run the tests, execute npm run test in your project folder.

Usage

To use the library you must require it in your code:

const Base16 = require("base16.js");

To encode your text content, use the Encode() method:

let encoded = Base16.Encode("Hello World!, This is a test.");
console.log(encoded); // Outputs 48656c6c6f20576f726c64212c2054686973206973206120746573742e

To decode an encoded text, use the Decode() method:

let decoded = Base16.Decode("48656c6c6f20576f726c64212c2054686973206973206120746573742e");
console.log(decoded); // Outputs Hello World!, This is a test.

More info

This algorithm replace each ASCII character with two ASCII characters, therefore there's a double overhead.

In a mathematical language, if the text is n bytes in size (or length, doesn't matter because we're using ASCII), then the resultant text will be 2*n bytes in size, this implies a 100% increment in size (overhead), unlike Base64 which has approximately 33.333333% overhead.

base16.js's People

Contributors

eyad-bereh avatar

Watchers

James Cloos avatar  avatar

base16.js's Issues

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.