Computer Science I / Hashing and Dictionaries
Practice question · Multiple choice

Language runtimes now seed their hash functions randomly at process start, so the same string hashes differently between runs. What attack does that prevent?

Hints
  1. The worst case needs every key in one bucket. Ask who could arrange that deliberately.
  2. It is a denial of service, not a data leak. What resource is exhausted?
Show the answer

C. Hash flooding, crafted keys that all collide into one bucket

Why

The O(n) worst case is improbable by accident and reachable on purpose, a few thousand colliding form fields can pin a CPU. Random seeding makes the collisions unpredictable, and it is a good illustration that 'the worst case never happens' holds only while nobody is trying.

Read the lesson: Hashing and Dictionaries →

Practise Hashing and Dictionaries

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Hashing and Dictionaries