3 ms·
Can you show me an implementation of a high-performance hash table with a cryptographic key that is not vulnerable to hash-flooding?
by bjourne 5y ago
Can you show me an implementation of a high-performance hash table with a cryptographic key that is not vulnerable to hash-flooding?
- goldenkey 5y agoAll you have to do is have the hashmap be HashMap<K,V,CryptographicKey> and never reveal the key, or seed it from randomness? One can use an HMAC or some other method to use the key to derive hashes.
- bjourne 5y agoIs there as HashMap overload with three type parameters? Yes, you can use a cryptographic hash function like SipHash does but it wouldn't perform has well as HashMap.
- vlovich123 5y agoIn Java? No. Rust is safe out of the box while retaining O(1) properties at all times
- dhosek 5y agoBut there is a heavy multiplier on that O(1) with the default hasher in Rust. My benchmarking has shown that FNVHasher gave me a 24% decrease in execution time over the default hasher. My use case had a high likelihood of a poll on the hash indicating that there was no match, and I got a near doubling of speed just by setting the initial capacity sufficiently large.
- vlmutolo 5y agoRust's standard library HashMap is a good example.