Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
nano-base32
Advanced tools
Readme
A small, quick, self-contained implementation of the Base32 encoding/decoding scheme used by the cryptocurrency Nano.
$ yarn add nano-base32
or
$ npm install --save nano-base32
const nanoBase32 = require('nano-base32')
const hexToArrayBuffer = require('hex-to-array-buffer')
const arrayBufferToHex = require('array-buffer-to-hex')
const blake = require('blakejs')
const pubKey = '0D7471E5D11FADDCE5315C97B23B464184AFA8C4C396DCF219696B2682D0ADF6'
const buffer = new Uint8Array(hexToArrayBuffer(pubKey))
const encoded = nanoBase32.encode(buffer)
// => 15dng9kx49xfumkm4q6qpaxneie6oynebiwpums3ktdd6t3f3dhp
const checksum = blake.blake2b(buffer, null, 5).reverse()
// => Uint8Array [ 33, 233, 215, 36, 38 ]
const checksumEncoded = nanoBase32.encode(checksum)
// => 69nxgb38
const address = `xrb_${encoded}${checksumEncoded}`
// => xrb_15dng9kx49xfumkm4q6qpaxneie6oynebiwpums3ktdd6t3f3dhp69nxgb38
const decoded = nanoBase32.decode(encoded)
const decodedHex = arrayBufferToHex(decoded.buffer).toUpperCase()
// => 0D7471E5D11FADDCE5315C97B23B464184AFA8C4C396DCF219696B2682D0ADF6
const decodedChecksum = nanoBase32.decode(checksumEncoded)
// => Uint8Array [ 33, 233, 215, 36, 38 ]
/**
* Decodes a Nano-implementation Base32 encoded string into a Uint8Array
* @param {string} input A Nano-Base32 encoded string
* @returns {Uint8Array}
*/
function decode (input)
/**
* Encode provided Uint8Array using the Nano-specific Base-32 implementeation.
* @param {Uint8Array} view Input buffer formatted as a Uint8Array
* @returns {string}
*/
function encode (view)
$ git clone https://github.com/termhn/node-base32
$ cd node-base32
$ yarn install
$ yarn test
Encoding and decoding algorithms based on:
FAQs
A small, quick, self-contained implementation of the Base32 encoding/decoding scheme used by the cryptocurrency Nano.
The npm package nano-base32 receives a total of 25,252 weekly downloads. As such, nano-base32 popularity was classified as popular.
We found that nano-base32 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.