MCPcopy Index your code
hub / github.com/nodejs/node / pbkdf2

Function pbkdf2

lib/internal/crypto/pbkdf2.js:38–65  ·  view source on GitHub ↗
(password, salt, iterations, keylen, digest, callback)

Source from the content-addressed store, hash-verified

36} = require('internal/crypto/keys');
37
38function pbkdf2(password, salt, iterations, keylen, digest, callback) {
39 if (typeof digest === 'function') {
40 callback = digest;
41 digest = undefined;
42 }
43
44 ({ password, salt, iterations, keylen, digest } =
45 check(password, salt, iterations, keylen, digest));
46
47 validateFunction(callback, 'callback');
48
49 const job = new PBKDF2Job(
50 kCryptoJobAsync,
51 password,
52 salt,
53 iterations,
54 keylen,
55 digest);
56
57 job.ondone = (err, result) => {
58 if (err !== undefined)
59 return FunctionPrototypeCall(callback, job, err);
60 const buf = Buffer.from(result);
61 return FunctionPrototypeCall(callback, job, null, buf);
62 };
63
64 job.run();
65}
66
67function pbkdf2Sync(password, salt, iterations, keylen, digest) {
68 ({ password, salt, iterations, keylen, digest } =

Callers

nothing calls this directly

Calls 3

checkFunction · 0.70
fromMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…