[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ideas
Subject:    [Python-ideas] set arbitrary hash random seed to ensure reproducible results
From:       "Hao Hu" <hao.hu.fr () gmail ! com>
Date:       2021-12-17 14:07:38
Message-ID: 163975005814.5815.3455710396580382655 () mail ! python ! org
[Download RAW message or body]

Hi,

I am wondering if it would be good to add an additional keyword `seed` to the builtin \
function *hash* to allow us to set arbitrary seed to ensure reproducible results. As \
far as I know, there exists already the environment variable PYTHONHASHSEED that \
allows us to set arbitrary seed or disable the seed globally for the python \
interpreter. However, it looks like that it would be too bold to use that environment \
variable to change the default behavior because the random seed generation helps \
improve the security my reducing the risk of hash flooding.

In parallel, we have identified a couple of real use cases that require that an \
arbitrary seed is used for a limited scope. For instance, if we create a caching \
programming interface that relies on a distributed kv store, it would be very \
important to make sure that the hash key stays the same when the application is \
rebooted or replicated. It is generally more cautious to use the above capability to \
limit the scope to the caching library itself instead of applying the same for all \
the hash functions of all the python interpreters.

WDYT?

Kind regards,

Hao
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/RRPEOREIWJ4AGDOYWQKIT6SRTC5ISDP3/
 Code of Conduct: http://python.org/psf/codeofconduct/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic