node-multi-hashing/README.md

81 lines
2.7 KiB
Markdown
Raw Permalink Normal View History

2014-03-30 10:04:48 +02:00
node-multi-hashing
===============
2014-04-01 00:43:22 +02:00
[![Build Status](https://travis-ci.org/zone117x/node-multi-hashing.png?branch=master)](https://travis-ci.org/zone117x/node-multi-hashing)
[![NPM](https://nodei.co/npm/multi-hashing.png?downloads=true&stars=true)](https://nodei.co/npm/multi-hashing/)
2014-03-30 10:04:48 +02:00
Cryptocurrency hashing functions for node.js.
2014-06-14 21:11:19 +02:00
Algorithms
----------
* quark
* x11
* x13
* nist5
* scrypt
* scryptn
* scryptjane
* keccak
* bcrypt
* skein
* groestl
* blake
* fugue
* qubit
* hefty1
* shavite3
* cryptonight
* boolberry
2014-03-30 10:04:48 +02:00
Usage
-----
Install
```bash
npm install multi-hashing
```
2014-03-30 10:56:39 +02:00
So far this native Node.js addon can do the following hashing algos
2014-03-30 10:04:48 +02:00
```javascript
var multiHashing = require('multi-hashing');
var algorithms = ['quark', 'x11', 'scrypt', 'scryptn', 'scryptjane', 'keccak', 'bcrypt', 'skein', 'blake'];
2014-03-30 10:56:39 +02:00
var data = new Buffer("7000000001e980924e4e1109230383e66d62945ff8e749903bea4336755c00000000000051928aff1b4d72416173a8c3948159a09a73ac3bb556aa6bfbcad1a85da7f4c1d13350531e24031b939b9e2b", "hex");
2014-03-30 10:04:48 +02:00
2014-03-30 10:56:39 +02:00
var hashedData = algorithms.map(function(algo){
if (algo === 'scryptjane'){
//scryptjane needs block.nTime and nChainStartTime (found in coin source)
var yaCoinChainStartTime = 1367991200;
2014-03-30 11:20:19 +02:00
var nTime = Math.round(Date.now() / 1000);
2014-03-30 11:17:14 +02:00
return multiHashing[algo](data, nTime, yaCoinChainStartTime);
2014-03-30 10:56:39 +02:00
}
else{
return multiHashing[algo](data);
2014-03-30 10:56:39 +02:00
}
});
console.log(hashedData);
2014-03-30 10:04:48 +02:00
//<SlowBuffer 0b de 16 ef 2d 92 e4 35 65 c6 6c d8 92 d9 66 b4 3d 65 ..... >
2014-03-30 10:56:39 +02:00
2014-03-30 10:04:48 +02:00
```
Credits
-------
2014-03-30 13:20:20 +02:00
* [NSA](http://www.nsa.gov/) and [NIST](http://www.nist.gov/) for creation or sponsoring creation of SHA2 and SHA3 algos
2014-03-30 13:19:01 +02:00
* [Keccak](http://en.wikipedia.org/wiki/Keccak) - Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche
* [Skein](http://en.wikipedia.org/wiki/Skein_(hash_function)) - Bruce Schneier, Stefan Lucks, Niels Ferguson, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas and Jesse Walker.
* [BLAKE](http://en.wikipedia.org/wiki/BLAKE_(hash_function)) - Jean-Philippe Aumasson, Luca Henzen, Willi Meier, and Raphael C.-W. Phan
* [Grøstl](http://en.wikipedia.org/wiki/Gr%C3%B8stl) - Praveen Gauravaram, Lars Knudsen, Krystian Matusiewicz, Florian Mendel, Christian Rechberger, Martin Schläffer, and Søren S. Thomsen
* [JH](http://en.wikipedia.org/wiki/JH_(hash_function)) - Hongjun Wu
* [Fugue](http://en.wikipedia.org/wiki/Fugue_(hash_function)) - Shai Halevi, William E. Hall, and Charanjit S. Jutla
* [scrypt](http://en.wikipedia.org/wiki/Scrypt) - Colin Percival
* [bcrypt](http://en.wikipedia.org/wiki/Bcrypt) - Niels Provos and David Mazières
2014-04-25 07:16:28 +02:00
* [X11](http://www.darkcoin.io/), [Hefty1](http://heavycoin.github.io/about.html), [Quark](http://www.qrk.cc/) creators (they just mixed together a bunch of the above algos)