ethers.js/src.ts/utils/pbkdf2.ts
2018-06-19 02:12:57 -04:00

14 lines
437 B
TypeScript

'use strict';
import { pbkdf2Sync as _pbkdf2 } from 'crypto';
import { arrayify, Arrayish } from './bytes';
function bufferify(value: Arrayish): Buffer {
return new Buffer(arrayify(value));
}
export function pbkdf2(password: Arrayish, salt: Arrayish, iterations: number, keylen: number, hashAlgorithm: string): Uint8Array {
return arrayify(_pbkdf2(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm));
}