export default class HexUtil {
  /**
   * 转16进制字符串
   * @param limit 转换长度限制
   */
  static toHexStr(data: number[] | Uint8Array, limit?: number) {
    const arr: string[] = [];

    for (let i = 0; i < (limit || data.length); i++) {
      arr.push(data[i].toString(16).padStart(2, "0"));
    }

    return arr.join(" ");
  }
}
