It may be a little late, but I do not understand why you cannot use struct:
bigint = 0xFEDCBA9876543210FEDCBA9876543210L print bigint,hex(bigint).upper() cbi = struct.pack("!QQ",bigint&0xFFFFFFFFFFFFFFFF,(bigint>>64)&0xFFFFFFFFFFFFFFFF) print len(cbi)
bigint itself is rejected, but if you mask it with & 0xFFFFFFFFFFFFFFFF, you can reduce it to 8 bytes of int instead of 16. Then the top is shifted and masked. You may need to play a bit with the byte. I used! to tell him to create a serial byte address of the network. In addition, you may need to change the value of msb and lsb (upper and lower bytes). I will leave this as an exercise for user definition. I would say saving things, since the network endian will be more secure, so you always know what the endianess of your data is.
No, don’t ask me if the network endian is big or small endian ...
Demolishun
source share