1 | var sjcl = require('sjcl'); |
||
2 | |||
3 | var hmacSha512 = function(key) { |
||
4 | var hasher = new sjcl.misc.hmac(key, sjcl.hash.sha512); |
||
5 | this.encrypt = function() { |
||
6 | return hasher.encrypt.apply(hasher, arguments); |
||
7 | }; |
||
8 | }; |
||
9 | |||
10 | var pbkdf2Sha512 = function(pw, salt, iterations, keySizeBytes) { |
||
11 | salt = sjcl.codec.hex.toBits(salt.toString('hex')); |
||
12 | var data = sjcl.codec.hex.toBits(pw.toString('hex')); |
||
13 | return new Buffer(sjcl.codec.hex.fromBits(sjcl.misc.pbkdf2(data, salt, iterations, keySizeBytes * 8, hmacSha512)), 'hex'); |
||
0 ignored issues
–
show
|
|||
14 | }; |
||
15 | |||
16 | module.exports = { |
||
17 | digest: pbkdf2Sha512 |
||
18 | }; |
||
19 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.