← mercor Interview Insights

mercor·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Mercor software engineer interview that got into cryptography fundamentals, specifically one-way functions. Not what I expected from a SWE screen but here we are.

Questions Asked (1)

Q1

What is a one-way function in cryptography? Give a precise definition and describe where it actually shows up in real systems like password storage, digital signatures, or integrity checks.

Technical Trade-offsSystem Design
Author's notes

I knew the gist but stumbled on the 'precise' part.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start with a precise, formal definition of a one-way function, emphasizing the asymmetry between easy forward computation and hard inversion. Then, ground it in real-world systems by explaining how it underpins password storage, digital signatures, and integrity checks, highlighting the specific properties each use case relies on. Conclude by noting practical caveats like the need for salts, keyed hashes, or collision resistance.

Pro tip: Mention that while one-way functions are theoretical constructs, practical implementations use cryptographic hash functions (e.g., SHA-256) or keyed hashes (e.g., HMAC) that are believed to be one-way. Also, note that password storage requires additional measures like salting and slow hashing (e.g., bcrypt) to resist brute-force and rainbow table attacks.

1. Define one-way function precisely

State that a one-way function is a function f such that given x, computing f(x) is easy (polynomial time), but given f(x), finding any x' such that f(x') = f(x) is computationally infeasible. Optionally mention the stronger notion of a trapdoor one-way function.

2. Explain password storage

Describe how systems store hashed passwords using a one-way function (e.g., bcrypt, Argon2) so that even if the database is compromised, attackers cannot easily recover the original passwords. Emphasize the use of salts to prevent precomputation attacks.

3. Explain digital signatures

Explain that digital signatures use one-way functions (hash functions) to create a digest of the message, which is then signed with a private key. The one-way property ensures that the signed digest cannot be forged or reversed to reveal the message or private key.

4. Explain integrity checks

Describe how cryptographic hash functions (a practical instantiation of one-way functions) are used to verify data integrity, e.g., in checksums, HMACs, or blockchain. Any change to the data changes the hash, and the one-way property prevents an attacker from crafting a different message with the same hash.

5. Summarize and connect to system design

Tie back to the role by noting that understanding one-way functions is crucial for designing secure systems, choosing appropriate cryptographic primitives, and avoiding common pitfalls like using fast hashes for passwords.

Key Points to Mention

  • Formal definition: easy to compute, hard to invert (preimage resistance).
  • Practical instantiations: cryptographic hash functions (SHA-256, SHA-3) and keyed hashes (HMAC).
  • Password storage: use of salts, slow hashing algorithms (bcrypt, scrypt, Argon2) to resist brute-force and rainbow tables.
  • Digital signatures: hash-then-sign paradigm, ensuring integrity and non-repudiation.
  • Integrity checks: HMAC for message authentication, Merkle trees in blockchains.
  • Caveats: one-way functions are not proven to exist; rely on computational hardness assumptions.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.