Cryptographic Hashing and Digital Signatures Questions

Cryptographic hash functions (collision resistance, preimage resistance), message authentication codes, and digital-signature schemes. Covers HMAC, signature verification, and how hashing underpins integrity, commitments, and authentication. Distinct from non-cryptographic hashing used in data structures.

MediumTechnical
41 practiced

Walk through how you'd implement signature verification for a client-server API using JSON Web Signatures (JWS). What are the concrete ways this commonly goes wrong in production code, and how would you guard against algorithm confusion, replay of an old but validly-signed request, and any subtleties around exactly what bytes get hashed and signed?

EasyTechnical
49 practiced

Walk through how ECDSA signing and verification work at a high level, focusing on the role of the per-message nonce k. Why must k be unpredictable and unique for every signature, what goes wrong if it is reused or partially leaks, and how does deterministic nonce generation (RFC 6979) address that risk?

MediumTechnical
50 practiced

A service signs messages built by concatenating fields without separators, say user || timestamp || amount. Demonstrate how two different sets of field values could produce the exact same concatenated string (and therefore the same signature), then propose a fix. What would you actually change about how these messages get serialized before signing, and what backward-compatibility issues would your fix create?

MediumTechnical
42 practiced

A protocol uses the same hash function for several different purposes, say deriving a key, computing a MAC, and generating a commitment. What could go wrong if you don't domain-separate these uses, and how would you fix it? Give two concrete examples of mistakes this causes.

MediumTechnical
39 practiced

Write the RFC 6979 deterministic nonce generator (HMAC-DRBG) for ECDSA in Python. Implement a function rfc6979_generate_k(hash_bytes: bytes, x: int, q: int) -> int that outputs deterministic k in the range [1, q-1]. Follow the algorithm steps: initialize V and K, perform the HMAC loops, and iterate until k is in range. You may assume hashlib and hmac are available; focus on correct HMAC sequence rather than optimizations.

Unlock Full Question Bank

Get access to all Cryptographic Hashing and Digital Signatures interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.