ZZomato·BehavioralL3DSA Round

Detect Collisions in Hashing Functions Like MD5

viaGlassdoor

Question: How would you detect repetition (collisions) produced by hashing functions like MD5?

Answer framing: A hash collision occurs when two different inputs produce the same hash output. To detect collisions in practice: maintain a hash-to-input map and check on insert whether the same hash already maps to a different input; if so, a collision is detected. At scale, use a hash set/dictionary keyed by hash value with chaining (or a Bloom filter as a fast pre-check for "possibly seen before") to detect duplicates. MD5 specifically is cryptographically broken - collisions can be deliberately constructed, so collision-resistant hashes like SHA-256 are preferred for security-sensitive use cases.

Add a follow-up question they asked
No follow-ups yet. Be the first to add one.
asked …
LeaderboardSalary
Language
Account