UNPKG

@signumjs/util

Version:

Useful utilities and tools for building Signum Network applications

26 lines 1 kB
"use strict"; /** * Original work Copyright (c) 2018 PoC-Consortium * Modified work Copyright (c) 2019 Burst Apps Team */ Object.defineProperty(exports, "__esModule", { value: true }); exports.convertByteArrayToHexString = void 0; /** * Converts byte array to hexadecimal string * Inverse operation of {@link convertHexStringToByteArray} * @param bytes The (unsigned) byte array to be converted * @param uppercase If _true_, converts hex string with uppercase characters (Default: false) * @return {string} A hex string representing the byte array input * * @category conversion */ const convertByteArrayToHexString = (bytes, uppercase = false) => { const hex = []; for (const byte of bytes) { hex.push((byte >>> 4).toString(16)); hex.push((byte & 0xF).toString(16)); } return uppercase ? hex.join('').toUpperCase() : hex.join(''); }; exports.convertByteArrayToHexString = convertByteArrayToHexString; //# sourceMappingURL=convertByteArrayToHexString.js.map