2 ms·
Although this article is about collisions in the hash function applied to strings, for numeric values Python uses a hash() function that is not only easy to gen
by svat 7y ago
Although this article is about collisions in the hash function applied to strings, for numeric values Python uses a
hash() function that is not only easy to generate collisions for but actually to invert (and find all inverses). I learned about this when writing this answer:
• https://stackoverflow.com/questions/56227419/why-does-pythons-hash-of-infinity-have-the-digits-of-π/56227918#56227918 https://stackoverflow.com/questions/56227419/why-does-python...
and details and code on how to invert are here:
• https://stackoverflow.com/a/56248241/4958 https://stackoverflow.com/a/56248241/4958
(Needless to say, this is quite straightforward and trivial compared to collisions on strings; nevertheless it may be of some interest to someone.)