2acoin-multi-hashing 中文文档教程

发布于 4年前 浏览 29 项目主页 更新于 3年前

图片

Master Build Status

< img src="https://travis-ci.org/2acoin/node8-multi-hashing.svg?branch=master" alt="构建状态"> 构建状态

Development Build Status

构建状态Build status

2ACoin-multi-hashing

NodeJS 的加密货币哈希函数

现在支持 Windows

Algorithms

  • argon2/chukwa
  • blake
  • boolberry
  • bcrypt
  • cryptonight
  • cryptonight-fast
  • cryptonight-lite
  • fugue
  • groestl
  • hefty1
  • keccak
  • nist5
  • qubit
  • quark
  • scrypt
  • scryptn
  • scryptjane
  • shavite3
  • skein
  • x11
  • x13

Usage

Install

sudo apt-get nodejs nodejs-dev node-gyp npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
npm install 2acoin-multi-hashing

本机 NodeJS 插件的示例使用。 (请参阅上面支持的算法的完整列表)。

javascript
var multiHashing = require('2acoin-multi-hashing')
var Buffer = require('safe-buffer').Buffer

var algorithms = ['quark', 'x11', 'scrypt', 'scryptn', 'scryptjane', 'keccak', 'bcrypt', 'skein', 'blake']

var data = new Buffer('7000000001e980924e4e1109230383e66d62945ff8e749903bea4336755c00000000000051928aff1b4d72416173a8c3948159a09a73ac3bb556aa6bfbcad1a85da7f4c1d13350531e24031b939b9e2b', 'hex')

var hashedData = algorithms.map(function (algo) {
  if (algo === 'scryptjane') {
     // scryptjane needs block.nTime and nChainStartTime (found in coin source)
     var yaCoinChainStartTime = 1367991200
     var nTime = Math.round(Date.now() / 1000)
     return multiHashing[algo](data, nTime, yaCoinChainStartTime)
  } else {
     return multiHashing[algo](data)
  }
})

console.log(hashedData)
//<SlowBuffer 0b de 16 ef 2d 92 e4 35 65 c6 6c d8 92 d9 66 b4 3d 65 ..... >

Credits

  • NSA and NIST for creation or sponsoring creation of SHA2 and SHA3 algos
  • Keccak - Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche
  • Skein - Bruce Schneier, Stefan Lucks, Niels Ferguson, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas and Jesse Walker.
  • BLAKE - Jean-Philippe Aumasson, Luca Henzen, Willi Meier, and Raphael C.-W. Phan
  • Grøstl - Praveen Gauravaram, Lars Knudsen, Krystian Matusiewicz, Florian Mendel, Christian Rechberger, Martin Schläffer, and Søren S. Thomsen
  • JH - Hongjun Wu
  • Fugue - Shai Halevi, William E. Hall, and Charanjit S. Jutla
  • scrypt - Colin Percival
  • bcrypt - Niels Provos and David Mazières
  • X11, Hefty1, Quark creators (they just mixed together a bunch of the above algos)
  • PhearZero Michael J Feher
  • codebling CodeBling
  • Monero The Monero Project
  • TurtleCoin TurtleCoin Developers
  • 2ACoin 2ACoin Developers

image

Master Build Status

Build StatusBuild status

Development Build Status

Build StatusBuild status

2ACoin-multi-hashing

Cryptocurrency hashing functions for NodeJS

Now with Windows support

Algorithms

  • argon2/chukwa
  • blake
  • boolberry
  • bcrypt
  • cryptonight
  • cryptonight-fast
  • cryptonight-lite
  • fugue
  • groestl
  • hefty1
  • keccak
  • nist5
  • qubit
  • quark
  • scrypt
  • scryptn
  • scryptjane
  • shavite3
  • skein
  • x11
  • x13

Usage

Install

sudo apt-get nodejs nodejs-dev node-gyp npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
npm install 2acoin-multi-hashing

Example use for native NodeJS addon. (See the complete list of supported algorithms above).

javascript
var multiHashing = require('2acoin-multi-hashing')
var Buffer = require('safe-buffer').Buffer

var algorithms = ['quark', 'x11', 'scrypt', 'scryptn', 'scryptjane', 'keccak', 'bcrypt', 'skein', 'blake']

var data = new Buffer('7000000001e980924e4e1109230383e66d62945ff8e749903bea4336755c00000000000051928aff1b4d72416173a8c3948159a09a73ac3bb556aa6bfbcad1a85da7f4c1d13350531e24031b939b9e2b', 'hex')

var hashedData = algorithms.map(function (algo) {
  if (algo === 'scryptjane') {
     // scryptjane needs block.nTime and nChainStartTime (found in coin source)
     var yaCoinChainStartTime = 1367991200
     var nTime = Math.round(Date.now() / 1000)
     return multiHashing[algo](data, nTime, yaCoinChainStartTime)
  } else {
     return multiHashing[algo](data)
  }
})

console.log(hashedData)
//<SlowBuffer 0b de 16 ef 2d 92 e4 35 65 c6 6c d8 92 d9 66 b4 3d 65 ..... >

Credits

  • NSA and NIST for creation or sponsoring creation of SHA2 and SHA3 algos
  • Keccak - Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche
  • Skein - Bruce Schneier, Stefan Lucks, Niels Ferguson, Doug Whiting, Mihir Bellare, Tadayoshi Kohno, Jon Callas and Jesse Walker.
  • BLAKE - Jean-Philippe Aumasson, Luca Henzen, Willi Meier, and Raphael C.-W. Phan
  • Grøstl - Praveen Gauravaram, Lars Knudsen, Krystian Matusiewicz, Florian Mendel, Christian Rechberger, Martin Schläffer, and Søren S. Thomsen
  • JH - Hongjun Wu
  • Fugue - Shai Halevi, William E. Hall, and Charanjit S. Jutla
  • scrypt - Colin Percival
  • bcrypt - Niels Provos and David Mazières
  • X11, Hefty1, Quark creators (they just mixed together a bunch of the above algos)
  • PhearZero Michael J Feher
  • codebling CodeBling
  • Monero The Monero Project
  • TurtleCoin TurtleCoin Developers
  • 2ACoin 2ACoin Developers
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文