GithubHelp home page GithubHelp logo

rmoorman / bs58 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cryptocoinjs/bs58

0.0 2.0 0.0 57 KB

Base58 encoding/decoding for Bitcoin

Home Page: http://cryptocoinjs.com/modules/misc/bs58/

JavaScript 100.00%

bs58's Introduction

bs58

build status

JavaScript component to compute base 58 encoding. This encoding is typically used for crypto currencies such as Bitcoin.

Note: If you're looking for base 58 check encoding, see: https://github.com/bitcoinjs/bs58check, which depends upon this library.

Install

npm i --save bs58

API

encode(input)

input must be a Buffer or an Array. It returns a string.

example:

var bs58 = require('bs58')

var unencodedData = "003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187"
var out = bs58.encode(new Buffer(unencodedData, 'hex'))
console.log(out) // => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS

decode(input)

input must be a base 58 encoded string. Returns an Array.

example:

var bs58 = require('bs58')

var address = "16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS"
var out = bs58.decode(address)
console.log(out.toString())
// => 0,60,23,110,101,155,234,15,41,163,233,191,120,128,193,18,177,179,27,77,200,38,38,129,135

// if using Node.js or browserify
console.log(new Buffer(out).toString('hex'))
// => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187

Hack / Test

Uses JavaScript standard style. Read more:

js-standard-style

Credits

License

MIT

bs58's People

Contributors

dcousens avatar jprichardson avatar rainabatwing avatar

Watchers

 avatar  avatar

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.