📄

Fixed hash seed in python

Created
Tagsnotepython

Hash value generation depends on a Hash seed. If the seed is not provided, hash will be generated randomly. To fix the hash value, we can set the value of environment variable PYTHONHASHSEED to a positive value. We can set the value in shell by type,

export PYTHONHASHSEED=122222

or

PYTHONHASHSEED=0 python YOURSCRIPT.py

reference:

https://stackoverflow.com/questions/30585108/disable-hash-randomization-from-within-python-program