hash() can return different values ββfor the same object in different operating systems, architectures, Python implementations, and Python versions.
It is intended to be used only within a single Python session, and not through sessions or machines. Therefore, you should never rely on the hash() value outside of this.
If you need hashing that produces the same results worldwide, consider checksums such as:
- MD5 or SHA1,
- xxHash, which on its author provides stable results for several OS and architecture, be it small or large endian, 32/64 bit, posix or not, etc.).
- or with some caution Murmur, as some versions may give different results on different architectures. For example, I tested this fist hand when porting C Murmur2 to an IBM S390 Linux installation (from all of the weird places!). To avoid problems, I ended up coding instead of a slow but arc independent clean Python implementation for this OS, not a C implementation.
source share