Context
I have an application which outputs data into files and which verifies the data via checksums. While everything was working correctly with Python 3.8.0 32bit
, I observed different checksums being generated with Python 3.8.4 64bit
. Following the data that was being dumped incorrectly, I believe I've narrowed it down to this code (as the files that fail are the only ones using this function).
The purpose of this method is to take a single value, 0-65535, and split it into two separate "bytes".
def integer_to_lsb_msb(value: int) -> List[int]:
if value < 0 or value > 65535:
raise ValueError("The input value does not qualify as a '16bit' value", value)
lsb = value & 0xFF
msb = ((value >> 8) & 0xFF)
return [lsb, msb]
Question
Does python not process code in an architecture independent way? If not, is there a way to check the architecture and run custom code to ensure identical output with both 32bit and 64bit versions?