I know we shouldn't rely on the return value of hash() to be consistent between different versions. But I have this legacy code that needs to be migrated from python 2.7 to python 3.6. And one critical part of it is that I need keep hash() result to be same.
Is there any way to achieve that?
I've tried to set PYTHONHASHSEED to 0, but it doesn't help.
$ PYTHONHASHSEED=0 python3
Python 3.6.3 (default, Oct 8 2017, 23:14:45)
>>> hash('abc')
4596069200710135518
$ python2
Python 2.7.14 (default, Mar 30 2018, 12:43:21)
>>> hash('abc')
1453079729188098211