Telegram Web K with changes to work inside I2P https://web.telegram.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

15 lines
383 B

export default function bytesFromHex(hexString: string) {
const len = hexString.length;
const bytes = new Uint8Array(Math.ceil(len / 2));
let start = 0;
if(len % 2) { // read 0x581 as 0x0581
bytes[start++] = parseInt(hexString.charAt(0), 16);
}
for(let i = start; i < len; i += 2) {
bytes[start++] = parseInt(hexString.substr(i, 2), 16);
}
return bytes;
}