base-hash

1.0.2 • Public • Published

base-hash

NPM Package

This is an awesome lightweight util helps to hash with different base

Example

 
const BaseHash = require('base-hash');
 
const baseHash = new BaseHash();
 
console.log(baseHash.encode(12345)); //dnh
console.log(baseHash.decode('dnh')); //12345
 

By default the characters used for hashing are

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

If you want to override the characters please refer the below code

const BaseHash = require('base-hash');
 
const baseHash = new BaseHash('abcde');
 
console.log(baseHash.encode(12345)); //deddea
console.log(baseHash.decode('deddea')); //12345

You also can check source code

LICENSE

MIT

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i base-hash

      Weekly Downloads

      4

      Version

      1.0.2

      License

      MIT

      Unpacked Size

      3.77 kB

      Total Files

      4

      Last publish

      Collaborators

      • kvvignesh