News for hackers. Stuff that matters.
Re:The Universal Data Structure by rnovak on Wednesday July 01, 2015 @03:54PM (#9814680)
Yes. A valid hash function certainly can be defined as a F(n): N x N -> n % 100

But that certainly cannot be considered a reasonable hash function. A string is basically an array of bytes (or code-points, in case of UTF-8).

To have any decent property (like, producing different outputs for miniscule changes in the input), you have to touch every element in the array.

For custom objects, yes, you don't have to hash every property, but for strings, yeah, the hash function will almost always depend on the length of the string.

There are no comments on this comment yet.