systemquery/src/lib/crypto/hash.mjs

10 lines
204 B
JavaScript

"use strict";
import crypto from 'crypto';
export default function hash(algorithm, encoding, data) {
let hasher = crypto.createHash(algorithm);
hasher.update(data);
return hasher.digest(encoding);
}