News for hackers. Stuff that matters.
Re:Hash Functions by gabetax on Saturday June 03, 2023 @12:31PM (#36178045)
Specifically, these functions to not provide "uniform distribution".
Re:Hash Functions by jagged-chisel on Saturday June 03, 2023 @12:59PM (#36178305)
That isn’t a requirement of an algorithm called a hash function
Re:Hash Functions by gabetax on Saturday June 03, 2023 @02:40PM (#36179332)
From the article:

> For a function to be useful as a hash function, it must exhibit the property of uniform distribution

It's also listed as the first property on the Wikipedia page:

https://en.wikipedia.org/wiki/Hash_function#Uniformity

Re:Hash Functions by jagged-chisel on Saturday June 03, 2023 @05:52PM (#36180874)
I can’t find the text you quoted. The article starts off:

> A hash function is any function that can be used to map data of arbitrary size to fixed-size values

And the first sentence in the section you link says

> A good hash function should map the expected inputs as evenly as possible over its output range.

It doesn’t have to be “good” to be a hash function.

Re:Hash Functions by anamexis on Saturday June 03, 2023 @06:17PM (#36181051)
That's not a meaningful definition of a hash function, then.

    def hash(val):
        return 0
Re:Hash Functions by jagged-chisel on Saturday June 03, 2023 @06:44PM (#36181225)
Yes, this is a hash function. Whether it’s “useful” or “good” is the purview of the architect.

Tangential edit: https://xkcd.com/221/

Re:Hash Functions by pcthrowaway on Sunday June 04, 2023 @04:59AM (#36184137)
The best thing about that one is that it seeds the panel with a random number every time you refresh
Re:Hash Functions by throwmeaway1212 on Saturday June 03, 2023 @06:46PM (#36181236)
That has a pretty uniform distribution..