Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Applied Cryptography for Developers Module 4

Hash functions and their uses interview questions

Interview questions on hash functions and their uses: short warm-ups, then what each harder question tests, the first step of a good answer and its follow-ups.

9 questions: 3 warm-ups and 6 with model answers · Levels: Fresher to staff

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    How do second-preimage resistance and collision resistance differ?

    Answered in the lesson Hash functions: SHA-2, SHA-3 and BLAKE2

  2. Fresher to mid

    How do integrity and authenticity differ, and which tools give each?

    Answered in the lesson Integrity checks, SRI and canonical hashing

  3. Fresher to mid

    What does a Merkle inclusion proof prove, and what does it not?

    Answered in the lesson Merkle trees and transparency logs

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Senior to staff

    Your company signs firmware images by computing their SHA-1 digest and signing it with RSA; 200,000 devices in the field verify those signatures. Several partner teams submit images for signing. Assess the risk and plan the move to a safe hash without bricking devices.

    What it tests
    Seeing a collision threat in a signing workflow, weighing who controls the inputs, and planning a staged migration across devices that verify signatures and cannot all be updated at once.
    First step
    Ask who chooses what gets signed. Partner teams submit the images, so anyone among them could prepare two images with one SHA-1 digest, have the harmless one signed, and ship the other with the same signature. Signing is a collision use, the one property SHA-1 has publicly lost.
    Follow-ups

    From the lesson Hash functions: SHA-2, SHA-3 and BLAKE2

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  2. Fresher to senior

    A design proposes document IDs made of the first 64 bits of the SHA-256 of each document's content, for up to a billion documents. Evaluate the chance of a clash, consider users who choose their documents, and recommend a length.

    What it tests
    Applying the birthday bound to a truncated hash, separating accidental clashes from chosen ones, and tying a length to a requirement such as ASVS 11.4.3.
    First step
    Use the birthday bound for accidents: n²/2^(b+1) with n = 10⁹ and b = 64 gives the chance of any clash. Then ask the second question separately: how much work does someone need to make two documents clash on purpose, when the collision search for 64 bits takes about 2³² hashes?
    Follow-ups

    From the lesson Hash functions: SHA-2, SHA-3 and BLAKE2

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  3. Mid to senior

    Your checkout page loads a script from a partner's content delivery network. How do you protect the page if that network is ever compromised, what breaks when the partner ships a new version, and what do you do about it?

    What it tests
    Using Subresource Integrity correctly, understanding its failure mode and CORS needs, and planning versioned updates or alternatives for scripts that change.
    First step
    Pin the exact bytes: give the script tag an integrity value of the form sha384-…, with crossorigin="anonymous" so the browser can check it. Then ask what the pin does on the day the file at that address changes: the browser refuses it, which is the protection, and also a coming outage if nobody plans for it.
    Follow-ups

    From the lesson Integrity checks, SRI and canonical hashing

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  4. Mid to senior

    Service A signs JSON payloads and service B verifies them, and about 3 % of valid payloads fail verification after a library upgrade in B. Find the cause and fix the design so that it cannot come back.

    What it tests
    Recognising that signatures cover exact bytes, finding re-serialisation differences, and choosing between signing raw bytes and a canonical form such as RFC 8785.
    First step
    Capture one failing payload as the bytes A signed and the bytes B verified, and compare them. Key order, spacing, number spellings such as 500.00 and 5e2, and escaping of non-ASCII characters all change the bytes without changing the data, and a library upgrade is a typical moment for such a change.
    Follow-ups

    From the lesson Integrity checks, SRI and canonical hashing

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes
  5. Senior to staff

    Design a tamper-evident audit log for an internal administration system, so that not even its own operators can remove or edit an entry without being noticed. What do you store, what do you publish, who checks what, and how often?

    What it tests
    Applying Merkle trees, signed tree heads, inclusion and consistency proofs to a real system, and seeing that detection depends on parties outside the log keeping old heads.
    First step
    Separate what the log does from what makes cheating visible. A Merkle tree over the entries, hashed as RFC 9162 defines it, gives a root per size; the protection comes from publishing signed tree heads somewhere the operators cannot rewrite, and from checkers that demand consistency proofs between heads.
    Follow-ups

    From the lesson Merkle trees and transparency logs

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Mid to senior

    Your monitoring of Certificate Transparency logs reports a certificate for login.example.com, one of your domains, that nobody on your team requested. What do you do, in order, and what do you change afterwards?

    What it tests
    Turning CT detection into a response: verification, revocation through the issuing authority, finding how domain validation was passed, and prevention with CAA records and monitoring.
    First step
    Confirm before acting: read the logged certificate's issuer, names and validity, and check it against your own records and every team or vendor that may request certificates for the domain. If none did, treat it as misissuance or a compromise of how the domain is validated, and start the response at once.
    Follow-ups

    From the lesson Merkle trees and transparency logs

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes

All Applied Cryptography for Developers interview questions · The Applied Cryptography for Developers track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.