"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.computePublicKeyHash = exports.hexToBytes = exports.bytesToHex = void 0;
const assert = require("assert");
const hashjs = require("hash.js");
const BN = require("bn.js");
function bytesToHex(a) {
    return a
        .map((byteValue) => {
        const hex = byteValue.toString(16).toUpperCase();
        return hex.length > 1 ? hex : `0${hex}`;
    })
        .join('');
}
exports.bytesToHex = bytesToHex;
function hexToBytes(a) {
    assert.ok(a.length % 2 === 0);
    return new BN(a, 16).toArray(null, a.length / 2);
}
exports.hexToBytes = hexToBytes;
function computePublicKeyHash(publicKeyBytes) {
    const hash256 = hashjs.sha256().update(publicKeyBytes).digest();
    const hash160 = hashjs.ripemd160().update(hash256).digest();
    return Buffer.from(hash160);
}
exports.computePublicKeyHash = computePublicKeyHash;
//# sourceMappingURL=utils.js.map