News for hackers. Stuff that matters.
Re:Adaptive Hashing by tptacek on Saturday May 10, 2025 @10:52PM (#43950920)
Fun fact! A previous use of the term "adaptive hash" was as a descriptor for things like Bcrypt, which have the exact opposite goal (to consistently be as slow as possible regardless of advances in hardware).
Re:Adaptive Hashing by 90s_dev on Saturday May 10, 2025 @10:57PM (#43950951)
"tptacek's law: given enough time, diametrically opposed algorithms will have the same name"
Re:Adaptive Hashing by tptacek on Saturday May 10, 2025 @11:11PM (#43951042)
Yes! See: quicksort.
Re:Adaptive Hashing by tialaramex on Sunday May 11, 2025 @06:43AM (#43952861)
Huh? What's the other "quicksort" ? Tony's famous Quicksort I'm aware of, and while you should not use this algorithm this century† in its pure form it's still in the core of good sorts, you just need other ingredients too.

So what's the diametrically opposed algorithms with the same name ?

† Don't tell C++ programmers, some of their standard libraries only stopped shipping quicksort as the default algorithm during the Biden administration.

Re:Adaptive Hashing by Nevermark on Sunday May 11, 2025 @08:07AM (#43953228)
So we just flip a sign in Bcrypt! Or flip a decision Boolean? Or a sort order?

Regardless it will be easy. Apply the inverse operation of the “introduce more slowness” operation.

Unfortunately, I have seen some software in my day, and I don’t think it will work. Just really perverse stuff.

Re:Adaptive Hashing by vlovich123 on Saturday May 10, 2025 @11:24PM (#43951095)
> For string keys, hash only the first and last 2 characters. For list keys, only hash the first 4 elements.

I would think it make some sense to change these constants as the collision chain grows, thereby improving the hash quality of keys and avoiding collisions as the table gets larger and larger

Re:Adaptive Hashing by BoingBoomTschak on Sunday May 11, 2025 @04:55AM (#43952415)
> If too many collisions, double the limit.
Re:Adaptive Hashing by heisig on Sunday May 11, 2025 @01:34AM (#43951668)
Let me comment as an SBCL user: This is outstanding work, and I can now remove a lot of performance hacks from my code because the default hash tables became equally fast!

Also, this technique eliminates a number of worst-case scenarios and inefficiencies, which is a boon for any hash table user.