DEP0009:crypto.pbkdf2 未指定摘要


【DEP0009: crypto.pbkdf2 without digest】

类型:寿命终止

【Type: End-of-Life】

在 Node.js 6.0 中,如果未指定摘要就使用 crypto.pbkdf2() API,则被弃用,因为该方法默认使用不推荐的 'SHA1' 摘要。之前会打印弃用警告。从 Node.js 8.0.0 开始,如果调用 crypto.pbkdf2()crypto.pbkdf2Sync() 时将 digest 设置为 undefined,将会抛出 TypeError

【Use of the crypto.pbkdf2() API without specifying a digest was deprecated in Node.js 6.0 because the method defaulted to using the non-recommended 'SHA1' digest. Previously, a deprecation warning was printed. Starting in Node.js 8.0.0, calling crypto.pbkdf2() or crypto.pbkdf2Sync() with digest set to undefined will throw a TypeError.】

从 Node.js v11.0.0 开始,当 digest 设置为 null 调用这些函数时,会打印弃用警告,以与 digestundefined 时的行为保持一致。

【Beginning in Node.js v11.0.0, calling these functions with digest set to null would print a deprecation warning to align with the behavior when digest is undefined.】

但是,现在传入 undefinednull 会抛出 TypeError

【Now, however, passing either undefined or null will throw a TypeError.】