UNPKG

@aeternity/aepp-calldata

Version:
18 lines (17 loc) 590 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.symbolIdentifier = exports.hash = void 0; var _blake2b = _interopRequireDefault(require("blakejs/blake2b.js")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const HASH_BYTES = 32; const hash = name => { return Array.from(_blake2b.default.blake2b(name, null, HASH_BYTES)); }; exports.hash = hash; const symbolIdentifier = funName => { // First 4 bytes of 32 bytes blake hash return hash(funName).slice(0, 4); }; exports.symbolIdentifier = symbolIdentifier;