OwenDelahoy / node-cryptonight

node bindings for cryptonight hashing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-cryptonight

node bindings for cryptonight hashing

Requirements

node-cryptonight requires Boost

Ubuntu
sudo apt-get install libboost-all-dev
Mac
brew install boost

Installation

npm install --save node-cryptonight

Testing

Code is linted with standard and tested with Jest. Run npm test to lint and run tests.

Usage Examples

Synchronous Hashing
const cryptonight = require('node-cryptonight').hash
const hash = cryptonight(Buffer.from('This is a test'))
console.log(hash) // <Buffer a0 84 f0 1d 14 37 ..>
Asynchronous Hashing
const cryptonight = require('node-cryptonight').asyncHash
cryptonight(Buffer.from('This is a test'), hash => {
  console.log(hash) // <Buffer a0 84 f0 1d 14 37 ..>
})
Promise Wrapper Example
function cryptonight(data) {
  return new Promise((resolve, reject) => {
    require('node-cryptonight').asyncHash(data, hash => {
      resolve(hash)
    })
  })
}

cryptonight(Buffer.from('This is a test'))
  .then(console.log) // <Buffer a0 84 f0 1d 14 37 ..>

See Also

License

Released under the 3-Clause BSD License. Contains code from the Monero project. See LICENSE for more information.

About

node bindings for cryptonight hashing

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:JavaScript 53.7%Language:C++ 36.0%Language:Python 10.3%