diff options
Diffstat (limited to 'Functions/pbkdf2promise.js')
-rw-r--r-- | Functions/pbkdf2promise.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Functions/pbkdf2promise.js b/Functions/pbkdf2promise.js new file mode 100644 index 0000000..ac63f43 --- /dev/null +++ b/Functions/pbkdf2promise.js @@ -0,0 +1,14 @@ +const crypto = require('node:crypto'); + +function pbkdf2(password, salt, iterations, keylen, digest) { + return new Promise((resolve, reject) => { + crypto.pbkdf2(password, salt, iterations, keylen, digest, (err, res) => { + if (err) + reject(err); + else + resolve(res); + }); + }); +} + +exports.pbkdf2 = pbkdf2; |