[MLton] MLton.hash deeply flawed

Wesley W. Terpstra wesley at terpstra.ca
Sun Nov 1 16:06:53 PST 2009


Strings that differ in only a few places don't get unique hash values
from MLton.hash. In a program where I tried to use MLton.hash I had 38
collisions out of 8325 distinct input strings. Not good.

val x = "klahjflaskjflaksjfgklajsglkasjglaksjglaksjglaksgjaklsgaslkgjaslgkjas"
val y = "klahjflbskjflaksjfgklajsglkasjglaksjglaksjglaksgjaklsgaslkgjaslgkjaS"

val () = print (Word32.toString (MLton.hash x) ^ "\n")
val () = print (Word32.toString (MLton.hash y) ^ "\n")



More information about the MLton mailing list