Threats, Vulnerabilities, and Mitigations
An attacker prepares many variants of a benign and a malicious contract, seeking any pair with the same digest; success is expected after about 2^(n/2) tries for an n-bit hash. Which change best raises the cost of this attack?
Show the answer
Correct answerB. Switch to a hash function with a longer digest
AWhy not this: Salting protects stored passwords and does not affect matching digests of two contracts.
BWhy this is right: A longer digest raises the 2^(n/2) work needed to find any matching pair.
CWhy not this: Encrypting the contract hides its content but leaves the matching-digest search unchanged.
DWhy not this: The attack finds matching digests, so changing the signing key does not make a match any harder.
This is a birthday attack, whose effort is about 2^(n/2), so doubling the digest length squares the work needed. Rotating the signing key does not help, because the attacker needs matching digests, not the key.