scryptsy
scryptsy
is a pure Javascript implementation of the scrypt key derivation function that is fully compatible with Node.js and the browser (via Browserify).
Why?
Scrypt
is an integral part of many crypto currencies. It's a part of the BIP38 standard for encrypting private Bitcoin keys. It also serves as the proof-of-work system for many crypto currencies, most notably: Litecoin and Dogecoin.
Installation
npm install --save scryptsy
Example
var scrypt = require('scryptsy')
var key = "pleaseletmein"
var salt = "SodiumChloride"
var data = scrypt(key, salt, 16384, 8, 1, 64)
console.log(data.toString('hex'))
API
scrypt(key, salt, N, r, p, keyLenBytes, [progressCallback])
- key: The key. Either
Buffer
or string
. - salt: The salt. Either
Buffer
or string
. - N: The number of iterations.
number
(integer) - r: Memory factor.
number
(integer) - p: Parallelization factor.
number
(integer) - keyLenBytes: The number of bytes to return.
number
(integer) - progressCallback: Call callback on every
1000
ops. Passes in {current, total, percent}
as first parameter to progressCallback()
.
Returns Buffer
.
Resources
License
MIT