UNPKG

@tiny-utils/crypto

Version:

Tiny utils for crypto: asymmetric/symmetric encryption, ed25519, sha256, etc.

18 lines 679 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.sha256 = void 0; var js_sha256_1 = __importDefault(require("js-sha256")); /** * @category Crypto * @description Method to calculate SHA256 hash of the arbitrary data (bytes array or string) * @param data Data to calculate hash * @returns 32-bytes array with the SHA256 hash of the data */ var sha256 = function (data) { return new Uint8Array(js_sha256_1.default.sha256.digest(data)); }; exports.sha256 = sha256; //# sourceMappingURL=sha256.js.map