Skip to content

Commit

Permalink
add crypto.hash() as a shortcut to `crypto.createHash().update().di…
Browse files Browse the repository at this point in the history
…gest()`
  • Loading branch information
foxt committed Jun 19, 2024
1 parent b638139 commit 8938dbf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = r

// eslint-disable-next-line no-multi-assign
exports.createHash = exports.Hash = require('create-hash');
exports.hash = function (algorithm, data, outputEncoding) {
return exports.createHash(algorithm).update(data).digest(outputEncoding);
};

// eslint-disable-next-line no-multi-assign
exports.createHmac = exports.Hmac = require('create-hmac');
Expand Down

0 comments on commit 8938dbf

Please sign in to comment.