4 ms·
> t.hash(0.00000000000000001) '0000000000000000' > t.hash(0.00000000000000002) '00000000ffffffff' > t.hash(0.00000000000000003) '00000000ffffffff
by dchest 9y ago
> t.hash(0.00000000000000001)
'0000000000000000'
> t.hash(0.00000000000000002)
'00000000ffffffff'
> t.hash(0.00000000000000003)
'00000000ffffffff'
> t.hash(0.00000000000000004)
'00000000ffffffff'
> t.hash(0.00000000000000005)
'00000000fdffffff'
> 0.00000000000000001
> t.hash(1e17)
'5555555597d44646'
> t.hash(1e18)
'55555555ac43d2d1'
> t.hash(1e19)
'55555555acd2b64f'
> t.hash('\000')
'0000000000000000'
> t.hash('\000\000')
'5555555592244992'
> t.hash('\000\000\000')
'0000000000000000'
> t.hash('\001')
'9224499200000000'
> t.hash('\002')
'33333333dedddddd'
- speps 9y agoSo your point is that the name of the hash is appropriate? Today I fucked up a hash function...?
- 19eightyfour 9y agoHaha. Well the name is good then. Since it will work everyday.
- aappleby 9y agoI was going to ask if he'd run it through SMHasher, but... yeah, clearly not. -Austin (author of murmurhash/smhasher)
- 19eightyfour 9y agoThank you, Austin. I'll look into SMHasher. Really appreciate you pointing me in that direction.
- 19eightyfour 9y agoAustin, I've done a first test of a slightly modified CPP version. Thanks very much for this library. It really is so useful. SMHasher fork testing tifuhash is here: https://github.com/dosaygo-coder-0/smhasher https://github.com/dosaygo-coder-0/smhasher And I posted the results in the repo: https://github.com/dosaygo-coder-0/tifuhash/blob/master/tifuhash.smhasher.results.txt https://github.com/dosaygo-coder-0/tifuhash/blob/master/tifu...
- 19eightyfour 9y agoSorry I'd changed the file name : https://github.com/dosaygo-coder-0/tifuhash/blob/master/tifuhash.smhasher.results.1Gb.txt https://github.com/dosaygo-coder-0/tifuhash/blob/master/tifu...
- deleted 9y ago[deleted]
- 19eightyfour 9y agoEdit: Update. I pushed a new version that addresses the collisions presented by dchest. I invite you to take a look. Thanks! -- Thanks for the feedback. I really appreciate it. Well done finding all those collisions. This is serious! Here's an issue: https://github.com/dosaygo-coder-0/tifuhash/issues/3 https://github.com/dosaygo-coder-0/tifuhash/issues/3 Tho it's already valuable enough you pointing this out -- if you have any ideas on how to improve for these cases, please let me know! Note to self: This community is so good. If something technical gets a bit of traction, you can count on people to find some holes in it. Very valuable. Just wanna say words can't express my gratitude at people's efforts at this. It's very helpful.
- pawadu 9y agoDumb questions, why is this a problem? t.hash(0.00000000000000002) == t.hash(0.00000000000000003) How often would this cause issues in real-world?
- elevensies 9y agoIf you use it for a hash table, every collision has to be "resolved" in a way that takes time: https://en.wikipedia.org/wiki/Hash_table#Collision_resolution https://en.wikipedia.org/wiki/Hash_table#Collision_resolutio... . So if a hash function has lots of collisions it will use the memory of the hash table less efficiently and cause inserts and lookups to be slower. I think collisions are undesirable for other reasons too, none of which are coming to me right now.
- pawadu 9y agoBut doesn't every hash function have some collisions? Why would this particular example be very bad?
- 19eightyfour 9y agoI'm of the same mindset. I mean -- surely there are some collisions always. And I actually liked the property of the original version that a zero value hashed to all zeroes. While the rest of the pre-image was shuffled. But I suppose that being able to compute collisions is not a great thing. You may think that if it is not intended to be used in a cryptographic sense it does not matter. However, if you can easily compute collisions you could, theoretically of course, launch a denial-of-service attacks on a service (cache denial) by sending lots of values to the same hash slot. I mean, with probing and so on there are ways around this and in the end maybe the conventional wisdom ought to be revised, maybe there isn't so much to worry about from a few collisions, even easy to compute ones. But, as it stands, right now, the market demands collision resistance. So I damn well gave it to them.