biketrack-app/node_modules/@ethersphere/bee-js/dist/cjs/utils/hash.js

22 lines
743 B
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.keccak256Hash = void 0;
// For ESM compatibility
const js_sha3_1 = __importDefault(require("js-sha3"));
const { keccak256 } = js_sha3_1.default;
/**
* Helper function for calculating the keccak256 hash with
* correct types.
*
* @param messages Any number of messages (strings, byte arrays etc.)
*/
function keccak256Hash(...messages) {
const hasher = keccak256.create();
messages.forEach(bytes => hasher.update(bytes));
return Uint8Array.from(hasher.digest());
}
exports.keccak256Hash = keccak256Hash;