Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
scs: explicitely specify digest for pbkdf2
Browse files Browse the repository at this point in the history
We keep SHA1 as PBKDF2 is fine with this hash function.
  • Loading branch information
vincentbernat committed Jul 13, 2017
1 parent f15afeb commit f6cd724
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/api/scs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
var crypto = require('crypto'),
config = require('../config'),
cipher = 'aes-256-cbc',
keyLength = 256/8,
ivLength = 128/8,
keyLength = 256 / 8,
ivLength = 128 / 8,
hmac = 'sha512',
hashLength = 512/8,
hashLength = 512 / 8,
key = config.get('secret'),
// We need unrelated encryption and authentication keys, let's
// split our key in two parts.
ekey = crypto.pbkdf2Sync(key.slice(0, Math.floor(key.length / 2)),
'salt', 2000, keyLength),
'salt', 2000, keyLength, 'sha1'),
hkey = crypto.pbkdf2Sync(key.slice(Math.floor(key.length / 2)),
'salt', 2000, hashLength);
'salt', 2000, hashLength, 'sha1');

module.exports.encode = function(clear) {
var iv = crypto.randomBytes(ivLength),
Expand Down

0 comments on commit f6cd724

Please sign in to comment.