ESM: Tidied up recently ported ops

This commit is contained in:
n1474335 2018-05-27 16:13:18 +01:00
parent 905bc6699e
commit 6768038a2f
14 changed files with 47 additions and 27 deletions

View file

@ -62,7 +62,9 @@ class DerivePBKDF2Key extends Operation {
*/
run(input, args) {
const passphrase = Utils.convertToByteString(args[0].string, args[0].option),
[, keySize, iterations, hasher, ] = args, //eslint-disable-line array-bracket-spacing
keySize = args[1],
iterations = args[2],
hasher = args[3],
salt = Utils.convertToByteString(args[4].string, args[4].option) ||
forge.random.getBytesSync(keySize),
derivedKey = forge.pkcs5.pbkdf2(passphrase, salt, iterations, keySize / 8, hasher.toLowerCase());