tweb-i2p/src/helpers/bytes/bytesToHex.ts
Eduard Kuzmenko 37d5b2a9ad Peer-to-Peer calls
Refactor bigInt
Refactor factorizing
2022-03-23 17:15:07 +02:00

9 lines
274 B
TypeScript

export default function bytesToHex(bytes: ArrayLike<number>) {
const length = bytes.length;
const arr: string[] = new Array(length);
for(let i = 0; i < length; ++i) {
arr[i] = (bytes[i] < 16 ? '0' : '') + (bytes[i] || 0).toString(16);
}
return arr.join('');
}