node-cryptonight
node bindings for moneroV7 cryptonight hashing
node-cryptonight requires Boost
sudo apt-get install libboost-all-dev
brew install boost
You need to install windows-build-tools(recommended version is msvc2015), and boost library
- Download Boost libray
- Locate boost library under C:/boost
npm install --global --production windows-build-tools
node-gyp configure --msvs_version=2015
locate boost library under C:/boost
'conditions': [
[
'OS=="win"',
{
'include_dirs': [
"C:/boost"
]
}
]
],
npm install --save node-cryptonight
Code is linted with standard and tested with Jest. Run npm test
to lint and run tests.
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 ..>
const cryptonight = require('node-cryptonight').asyncHash
cryptonight(Buffer.from('This is a test'), hash => {
console.log(hash) // <Buffer a0 84 f0 1d 14 37 ..>
})
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 ..>
Released under the 3-Clause BSD License. Contains code from the Monero project. See LICENSE
for more information.