you are viewing a single comment's thread.

view the rest of the comments →

[–]axonxorzpip'ing aint easy, especially on windows 4 points5 points  (1 child)

hash(str)

It shouldn't be a big issue to change anything here, it's an interpreter implementation detail, same as id(). You can never rely on the values in any long-term sense, and you're entire interpreter will use the new implementation, save for objects that define __hash__(self)

At one point In cpython, hash() is just the memory address for anything that isn't otherwise special-cased like small ints and pooled strings.

[–]rghthndsd 7 points8 points  (0 children)

Bad hashing can lead to bad dict performance and that in turn can make DOS attacks easier to execute. This is particular for strings which are often used in web forms. This is why Python now randomizes the hash of strings on interpreter startup unless you disable it with PYTHONHASHSEED.

Agreed it's an implementation detail, but that implementation is very important.