NodeJS 6encryption在贬低消息抱怨摘要?

我试图在我的NodeJS应用程序中使用本机encryption模块,但我不断收到弃用消息:

(node:26)DeprecationWarning:不指定摘要的crypto.pbkdf2已被弃用。 请指定一个摘要

我知道这是由于一个变化集,预计摘要向前移动: https : //github.com/nodejs/node/pull/4047

但是,从我所看到的,我的代码完全按照文档中概述的语法。 任何人看到我在这里做错了吗?

function verify (password, expected, callback) { const combined = Buffer.from(expected, 'base64') const saltBytes = combined.readUInt32BE(0) const hashBytes = combined.length - saltBytes - 8 const iterations = combined.readUInt32BE(4) const salt = combined.slice(8, saltBytes + 8) const hash = combined.toString('binary', saltBytes + 8) return crypto.pbkdf2(password, salt, iterations, hashBytes, 'sha512', (err, verify) => { if (err) return callback(err, false) return callback(null, verify.toString('binary') === hash) }) } 

注意 :如果它有什么区别,这是在瘦身版本的节点内执行的:6

经过多次挖掘,我终于明白了。 它与上面的代码段无关。 我正在使用当前版本为4.0.0的铁模块。 当前发布的版本不会传递摘要的参数,这会导致产生警告消息。

他们已经提交了代码来纠正这个问题 ,但还没有发布。 这应该尽快解决。