Coder Social home page Coder Social logo

base58check's Introduction

base58check

build status

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

Install

npm i --save base58check

API

string encode(data, prefix = '00', encoding = 'hex')

data must be a Buffer or a string. It returns a string.

example:

const base58check = require('base58check')

const data = '086eaa677895f92d4a6c5ef740c168932b5e3f44'
console.log(base58check.encode(data)) // => 1mayif3H2JDC62S4N3rLNtBNRAiUUP99k

{ prefix, data } decode(string[, encoding])

string must be a base 58 check encoded string. Returns a Object for prefix & data.

example:

const base58check = require('base58check')

const address = '1mayif3H2JDC62S4N3rLNtBNRAiUUP99k'
console.log(base58check.decode(address))
// => { prefix: <Buffer 00>, data: <Buffer 08 6e aa 67 78 95 f9 2d 4a 6c 5e f7 40 c1 68 93 2b 5e 3f 44> }

// if using encoding
console.log(base58check.decode(address, 'hex'))
// => { prefix: '00', data: '086eaa677895f92d4a6c5ef740c168932b5e3f44' }

Hack / Test

Uses JavaScript standard style. Read more:

js-standard-style

Credits

  • unrealce for original JavaScript implementation

Related

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

License

The MIT License (MIT)

Copyright (c) 2016

base58check's People

Contributors

wzbg avatar

Watchers

 avatar  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.