Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function prepareData(data: BufferSource): Buffer {
return Buffer.from(BufferSourceConverter.toArrayBuffer(data));
}
export function digest(algorithm: string, data: BufferSource): Buffer {
const hash = crypto.createHash(algorithm.replace("-", ""));
hash.update(prepareData(Buffer.from(BufferSourceConverter.toArrayBuffer(data))));
return hash.digest();
}