0.9.0 • Published 6 years ago

chacha8-native v0.9.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

chacha8 native

Build Status

Node bindings for Chacha8 (used for the pow algorithm for cryptonight), based on https://github.com/calvinmetcalf/chacha-native, based on Chacha20 this implementation.

install

npm install chacha8-native

usage

const ChaCha8 = require('chacha8-native');

var key = new Buffer([0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var iv = new Buffer([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var data = new Buffer([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);

var hexCipher = new ChaCha8(key, iv).update(data).toString('hex');

console.log(hexCipher);
0.9.0

6 years ago