UNPKG

@provenanceio/wallet-utils

Version:

Typescript Utilities for Provenance Blockchain Wallet

23 lines (18 loc) 587 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sha256 = void 0; var _crypto = require("crypto"); var _belt = require("@tendermint/belt"); /** * sha256 encryption of a byte array * @param bytes a byte array (Uint8Array) * @returns a sha256 encryted version of the given byte array */ var sha256 = function sha256(bytes) { var buffer1 = bytes instanceof Buffer ? bytes : Buffer.from(bytes); var buffer2 = (0, _crypto.createHash)('sha256').update(buffer1).digest(); return (0, _belt.bufferToBytes)(buffer2); }; exports.sha256 = sha256;