node-multi-hashing/README.md

56 lines
2.2 KiB
Markdown
Raw Normal View History

2014-03-30 10:04:48 +02:00
node-multi-hashing
===============
Cryptocurrency hashing functions for node.js.
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');
2014-03-30 11:10:38 +02:00
var algorithms = ['quark', 'x11', 'scrypt', 'scryptn', 'scryptjane', 'keccak', 'bcrypt'];
2014-03-30 10:56:39 +02:00
2014-03-30 10:04:48 +02:00
var data = new Buffer("hash me good bro");
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{
2014-03-30 11:17:14 +02:00
return 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
//Another example...
var hashedScryptData = multiHashing.scrypt(new Buffer(32));
2014-03-30 10:04:48 +02:00
```
Credits
-------
2014-03-30 13:19:01 +02:00
* [NSA](http://www.nsa.gov/) and [NIST](http://www.nist.gov/) for creation of sponsoring creation of SHA2 and SHA3 algos
* [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
* [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)