ethers.js/packages/pbkdf2/lib/pbkdf2.js

13 lines
529 B
JavaScript
Raw Normal View History

2020-11-17 07:07:24 +03:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
2021-03-08 02:24:04 +03:00
exports.pbkdf2 = void 0;
2020-11-17 07:07:24 +03:00
var crypto_1 = require("crypto");
var bytes_1 = require("@ethersproject/bytes");
function bufferify(value) {
2021-10-16 09:29:27 +03:00
return Buffer.from((0, bytes_1.arrayify)(value));
2020-11-17 07:07:24 +03:00
}
function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) {
2021-10-16 09:29:27 +03:00
return (0, bytes_1.hexlify)((0, crypto_1.pbkdf2Sync)(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm));
2020-11-17 07:07:24 +03:00
}
exports.pbkdf2 = pbkdf2;
//# sourceMappingURL=pbkdf2.js.map