UNPKG

@nervosnetwork/ckb-sdk-utils

Version:

Utils module of @nervosnetwork/ckb-sdk-core

16 lines 733 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.blake160 = void 0; const tslib_1 = require("tslib"); const blake2b_js_1 = (0, tslib_1.__importDefault)(require("./blake2b.js")); const index_js_1 = require("../convertors/index.js"); const const_js_1 = require("../const.js"); const blake160 = (data, encode = 'binary') => { const formattedData = typeof data === 'string' ? (0, index_js_1.hexToBytes)(data) : data; const s = (0, blake2b_js_1.default)(32, null, null, const_js_1.PERSONAL); s.update(formattedData); return s.digest(encode).slice(0, encode === 'binary' ? 20 : 40); }; exports.blake160 = blake160; exports.default = exports.blake160; //# sourceMappingURL=blake160.js.map