[Python-Dev] Hash randomization for which types?

Christoph Groth christoph at grothesque.org
Wed Feb 17 04:49:15 EST 2016


Stephen J. Turnbull wrote:
> Glenn Linderman writes:
>
>  > I think hashes of all types have been randomized, not _just_ the list 
>  > you mentioned.
>
> Yes.  There's only one hash function used, which operates on byte
> streams IIRC.  That function now has a random offset.  The details of
> hashing each type are in the serializations to byte streams.

Could you please elaborate?  Numbers are not hashed as byte streams, at
least not up to Python 3.5.  I am quite familiar with the way hashing of
numbers is done in Python 2 & 3.  (I had to re-implement this for a
project of mine: https://pypi.python.org/pypi/tinyarray/)



More information about the Python-Dev mailing list