Skip to content

Commit 8938dbf

Browse files
committed
add crypto.hash() as a shortcut to crypto.createHash().update().digest()
1 parent b638139 commit 8938dbf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = r
55

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

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

0 commit comments

Comments
 (0)