ethers.js/utils/pbkdf2.js

12 lines
443 B
JavaScript
Raw Permalink Normal View History

2018-06-13 15:39:39 -04:00
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
2018-06-19 02:12:57 -04:00
var crypto_1 = require("crypto");
2018-06-17 16:47:28 -04:00
var bytes_1 = require("./bytes");
2018-06-19 02:12:57 -04:00
function bufferify(value) {
2018-09-06 16:41:02 -04:00
return Buffer.from(bytes_1.arrayify(value));
2018-06-19 02:12:57 -04:00
}
function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) {
return bytes_1.arrayify(crypto_1.pbkdf2Sync(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm));
2018-06-13 15:39:39 -04:00
}
exports.pbkdf2 = pbkdf2;