@hashgraph/cryptography
Version:
Cryptographic utilities and primitives for the Hiero SDK
17 lines (16 loc) • 568 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.digest = digest;
var _crypto = _interopRequireDefault(require("crypto"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* @param {Uint8Array} data
* @returns {Promise<Uint8Array>}
*/
// eslint-disable-next-line @typescript-eslint/require-await
async function digest(data) {
// fallback to trying node-crypto which could be polyfilled by the browser environment
return _crypto.default.createHash("sha256").update(data).digest();
}