Skip to content

gghez/meteor-base58

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base58

Build Status

Encode / Decode using Base58 algorithm. Simplified usage to deal with String as well as Buffer and Array.

Port from NPM Module base-x

Used alphabet: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

Installation

meteor add gghez:base58

Usage

Client or Server side, global Base58 is available:

var encoded = Base58.encode('this is a clear sentence.');
// encoded == 'oqj3pKcxTmxVvrcVqyiFSCL5LkvsXjTYBX'

You can also use a Buffer as input for Base58.encode on Server where NodeJS provides Buffer object:

if (Meteor.isServer){
  var buffer = new Buffer('this is a clear sentence.');
  encoded = Base58.encode(buffer);
}

Decoding a Base58 string is very simple:

Base58.decode('oqj3pKcxTmxVvrcVqyiFSCL5LkvsXjTYBX');
// 'this is a clear sentence.'

Base58.decodeArray('oqj3pKcxTmxVvrcVqyiFSCL5LkvsXjTYBX');
// [116, 104, 105...]

API

Base58.encode(source)

Encodes a String, Array or Buffer to Base58 string. Note that Buffer encoding is only available on Server (NodeJS context).

Base58.decode(encoded)

Decodes an encoded Base58 string to a String.

Base58.decodeArray(encoded)

Decodes a string into a byte array.

About

Encode / Decode using Base58 algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published