Questions: Message Authentication Codes (MACs)

5 questions to test your understanding

Score: 0 / 5
Question 1 Short Answer

A developer authenticates messages by computing Tag = SHA-256(key || message), appending the raw key before the message. Why is this insecure, and what construction fixes it?

Think about your answer, then reveal below.
Question 2 Multiple Choice

Encryption provides confidentiality. A MAC provides integrity and authenticity. Why doesn't encryption alone provide integrity?

AEncryption algorithms are designed to be reversible, and any reversible function can be manipulated by an adversary
BStandard encryption (without authentication) is malleable — an attacker can modify ciphertext in ways that produce predictable changes to the plaintext upon decryption, without detection. For example, flipping a bit in CTR-mode ciphertext flips the corresponding plaintext bit
CEncryption keys are typically shorter than MAC keys, providing less security
DDecryption always succeeds regardless of input, so corrupted ciphertext looks like a valid but different message
Question 3 True / False

CBC-MAC is secure for fixed-length messages but insecure for variable-length messages without modification.

TTrue
FFalse
Question 4 Short Answer

A MAC guarantees that the message was sent by someone who knows the key, but it cannot prove which of the two key-holders sent it. Why is this a limitation compared to digital signatures?

Think about your answer, then reveal below.
Question 5 Multiple Choice

HMAC uses two hash invocations. Why can't a single invocation H(key || message) serve as a secure MAC?

AA single invocation is too slow for practical use
BH(key || message) is vulnerable to length extension with Merkle-Damgard hashes. HMAC's two-pass structure prevents this and is provably secure assuming the hash's compression function is a PRF
CThe hash function needs to process the key twice to achieve 256-bit security
DSingle invocation MACs can only handle fixed-length messages