to convert following hex value: 30347A120002AF4400000001.
the result is not the same with the result generated by an online converter (like RapidTables). It simply differs from position 52 to end...
(the result is expected to have 96 positions).
Question: are there some known limitations? why is the result different ?
So I can't say why you are getting a different result. Are you sure you are starting with the same hex value you have shared here? What actual result do you get?
this difference come up as i run the python script and the node red ... my problem is i need binary values between position 39 and 58 anything before and after is not relevant ... (just as explanation the hex value is the hex id of an RFID tag and between position 39 and 58 the item is that i need )
Since hex values are equivalent to 4 binary digits each, it might be easier to extract characters 9 to 15 and just convert those to binary. You won't run into any size limitations as it's only 20 bits.
// cutout only position 8 to 16
msg.payload = msg.payload.slice(7,16);
// define as hex
msg.payload = parseInt("0x"+msg.payload).toString(2);
// cutout only 1 to 12
msg.payload = msg.payload.slice(10,28);
// convert to dec
msg.payload = parseInt(msg.payload,2);
return msg;
i tested with 2 hex values and get the expected result.