Integrity
Integrity
Checking Integrity: To verify message integrity, we re-run the cryptographic hash function
and compare the new digest with the original; if they match, the message remains
unchanged.
If you have an input x1 (e.g., "Hello") with a hash value of 5d414, second preimage
resistance means that it should be hard to find a different input  (like "World") such that
("Hello")=H("World"). If you can find such a different input, the hash function fails this
property.
If you have an input x1 (e.g., "Hello") with a hash value of H(x1 )=5d414, second preimage
resistance means that it should be difficult to find a different input x2 (e.g., "World") such
that H(x1 )=H(x2 ). In this case, H("Hello")=H("World") would violate the second preimage
resistance property. If someone can find such a different input x2 that produces the same
hash as x1 , the hash function fails this property. Therefore, a secure hash function should
make it computationally infeasible to find any second input that generates the same hash
as the first.
Attack: Eve intercepts (has access to) a message M and its digest h(M). She creates
another message M′≠ M, but h(M) = h(M′). Eve sends the M′ and h(M′) to Bob. Eve has forged
the message.
Key Difference
Collision Resistance
Definition: Collision resistance means that it is hard to find any two different inputs x1 and
x2 such that H(x1 )=H(x2 ). This property ensures that no two distinct inputs should
produce the same hash value.
MESSAGE AUTHENTICATION:
Attack: If both the message and the MDC are sent through the insecure channel, Eve can
intercept the message, change it, create a new MDC from the message, and send both to
Bob. Bob never knows that the message has come from Eve. Note that the term safe can
mean a trusted party; the term channel can mean the passage of time.
MAC:
Message Authentication Code (MAC)
• Integrity: A MAC ensures that the message has not been modified. If even a single
bit of the message changes, the MAC will also change, indicating potential
tampering.
• Authentication: A MAC verifies the sender's identity. Only someone with the secret
key can generate a valid MAC for a given message, allowing the recipient to confirm
that the message originated from the expected sender.
If Alice wants to send a message to Bob securely, she creates a MAC using her message
and a secret key. She sends both the message and the MAC to Bob. Upon receiving them,
Bob uses the same secret key to generate a MAC from the received message. If his MAC
matches the one Alice sent, he can be confident that the message is authentic and
unchanged.