Nano-Base32
A small, quick, self-contained implementation of the Base32 encoding/decoding scheme used by the cryptocurrency Nano.
Installation
$ yarn add nano-base32
or
$ npm install --save nano-base32
Usage
const nanoBase32 = const hexToArrayBuffer = const arrayBufferToHex = const blake = const pubKey = '0D7471E5D11FADDCE5315C97B23B464184AFA8C4C396DCF219696B2682D0ADF6'const buffer = const encoded = nanoBase32// => 15dng9kx49xfumkm4q6qpaxneie6oynebiwpums3ktdd6t3f3dhp const checksum = blake// => Uint8Array [ 33, 233, 215, 36, 38 ]const checksumEncoded = nanoBase32// => 69nxgb38 const address = `xrb_`// => xrb_15dng9kx49xfumkm4q6qpaxneie6oynebiwpums3ktdd6t3f3dhp69nxgb38 const decoded = nanoBase32const decodedHex = // => 0D7471E5D11FADDCE5315C97B23B464184AFA8C4C396DCF219696B2682D0ADF6 const decodedChecksum = nanoBase32// => Uint8Array [ 33, 233, 215, 36, 38 ]
API
/** * Decodes a Nano-implementation Base32 encoded string into a Uint8Array * @param * @returns */ /** * Encode provided Uint8Array using the Nano-specific Base-32 implementeation. * @param * @returns */function encode (view)
## Running Tests
$ git clone https://github.com/termhn/node-base32
$ cd node-base32
$ yarn install
$ yarn test
Credit
Encoding and decoding algorithms based on:
- base32-encode - Base32 encoder
- base32-decode - Base32 decoder