UNPKG

chronik-cache

Version:

A cache helper for chronik-client

19 lines (18 loc) 749 B
"use strict"; // Copyright (c) 2024 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.computeHash = computeHash; const crypto_js_1 = __importDefault(require("crypto-js")); /** * Compute the hash using key data. * Only key data is passed to generate a consistent hash. */ function computeHash(data) { const hash = crypto_js_1.default.SHA256(JSON.stringify(data)); return hash.toString(crypto_js_1.default.enc.Hex); }