INNER CODE UNIT · JavaScript
convertHexToByteString
hackcatml/frida-flutterproxy · script.js:48
function convertHexToByteString(hexString) {
// Remove the '0x' prefix
let cleanHexString = hexString.startsWith('0x') ? hexString.slice(2) : hexString;
// Pad with a leading zero if the length is odd
if (cleanHexString.length % 2 !== 0) {
cleanHexString = '0' + cleanHexString;
}
// Split the string into pairs of two characters
let byteArray = cleanHexString.match(/.{1,2}/g);
// Reverse the order of the byte pairs
byteArray.reverse();
// Join the byte pairs with spaces
let byteString = byteArray.join(' ');