I believed that hash()
function works the same in all python interpreters. But it differs when I run it on my mobile using python for android. I get same hash value for hashing strings and numbers but when I hash built-in data types the hash value differs.
PC Python Interpreter (Python 2.7.3)
>>> hash(int)
31585118
>>> hash("hello sl4a")
1532079858
>>> hash(101)
101
Mobile Python Interpreter (Python 2.6.2)
>>> hash(int)
-2146549248
>>> hash("hello sl4a")
1532079858
>>> hash(101)
101
Can any one tell me is it a bug or I misunderstood something.
hash()
but maybe you could use base64 instead: docs.python.org/2/library/base64.html – Derryberry