Comparing version 2.0.1 to 2.0.2
{ | ||
"name": "scrypt-js", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "The scrypt password-based key derivation function with asynchronous operation and ablility to be cancelled.", | ||
@@ -5,0 +5,0 @@ "main": "scrypt.js", |
@@ -255,2 +255,7 @@ "use strict"; | ||
function ensureInteger(value, name) { | ||
var intValue = parseInt(value); | ||
if (value != intValue) { throw new Error('invalid ' + name); } | ||
return intValue; | ||
} | ||
@@ -263,2 +268,8 @@ // N = Cpu cost, r = Memory cost, p = parallelization cost | ||
N = ensureInteger(N, 'N'); | ||
r = ensureInteger(r, 'r'); | ||
p = ensureInteger(p, 'p'); | ||
dkLen = ensureInteger(dkLen, 'dkLen'); | ||
if (N === 0 || (N & (N - 1)) !== 0) { throw new Error('N must be power of 2'); } | ||
@@ -439,11 +450,12 @@ | ||
// Web Browsers | ||
} else { | ||
root.scrypt = scrypt; | ||
} else if (root) { | ||
// If there was an existing library "scrypt", make sure it is still available | ||
if (root && root.scrypt) { | ||
if (root.scrypt) { | ||
root._scrypt = root.scrypt; | ||
} | ||
root.scrypt = scrypt; | ||
} | ||
})(this); |
@@ -24,3 +24,3 @@ var nodeunit = require('nodeunit'); | ||
key = new Buffer(key); | ||
test.ok(derivedKeyHex === key.toString('hex'), 'failed to generate correct derived key'); | ||
test.equal(derivedKeyHex, key.toString('hex'), 'failed to generate correct derived key'); | ||
test.done(); | ||
@@ -27,0 +27,0 @@ } else { |
@@ -37,3 +37,14 @@ [ | ||
"derivedKey": "2101cb9b6a511aaeaddbbe09cf70f881ec568d574a2ffd4dabe5ee9820adaa478e56fd8f4ba5d09ffa1c6d927c40f4c337304049e8a952fbcbf45c6fa77a41a4" | ||
}, | ||
{ | ||
"password": "70617373776f7264", | ||
"salt": "7269636d6f6f", | ||
"N": "262144", | ||
"p": "1", | ||
"r": "8", | ||
"dkLen": "32", | ||
"derivedKey": "e286ed0298808c0b4bb4272ce947091b0da06bb530c4cbab3923e44ff48bbc25" | ||
} | ||
] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
225388
10
2674