JuliaLang/julia — pull request #6624 by StefanKarpinski (2014-04-24 17:33:58+00:00)
Title: WIP: new approach to efficiently hashing 1, 1.0, big(1), the same.

The major change is that numeric values that are mathematically equal hash the same. This is tricky to do in a way that allows the hashing of `Int64`, `Float64`, `Uint64` and such common numeric types to all be fast – nearly as fast as just applying the core hash to them as raw bits.

Although tests pass, this is an inherently half-baked state since isequal and hash are now badly out of sync. Many decisions still need to be made about how to hash collections: does the collection type matter or just the element type of the collection? Or neither?

This also does away with the bitmix function, instead favoring a Merkle-Damgård style of combining arbitrary amounts of data into a single, fixed-size hash value output. In a sense the hash function with two arguments replaces the bitmix function – you can give the result of hashing previous values as the second argument to hash and the result will depend on both in a difficult-to-predict way.