Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
scala.util.hashing.MurmurHash3 produces different outputs on 2.12 and 2.13 #11646
The following code
produces different output on 2.12 and 2.13. This is not something expected to happen. In case the implementation is considered unstable/incompatible with others it must be explicitly stated in the documentation.
I think this is a documentation issue--hashes of this nature (fast, non-cryptographic) tend to evolve rapidly and shouldn't be relied upon to be the same from version to version (not even in point releases!) because annoying weaknesses are often detected and fixed, and you don't want to be (dangerously) tied to old problematic versions for a long time.
Also, it would be good to have a stable (if perhaps deprecated) version that gives you a guaranteed algorithm, even if it is weak. But that's a longer-term fix.
In the short run, assuming that the algorithm matches what it's supposed to, we should just fix the documentation to explain that hashes can't be relied upon across versions, with a brief note about why. (I think for people who work seriously with hashing this would be the expectation, but a lot of people use hashes without becoming hashing experts, and we should help them out.)