I have some confusion that concerns the message digest.
I know that the message digest is the real message hashed with function and we use it to verify the integrity of the message.
I understand the usefulness of using this with asymmetric encryption but I can't find the utility of this with symmetric encryption.
I will explain my self:
We have Alice and Bob. Alice wants to transmit a message
m to bob with symmetric encryption. Suppose that the two of them know the encryption key in advance.
m with the key, hashes the message as
hash(m) and sends it to Bob as
Bob decrypts the message and then hashed to verify the integrity.
In this case I think that the
hash(message) is not needed because:
Case 1: If someone doesn't have the key they cannot cipher a message and send it to Bob pretending to be Alice because Bob will know that the message wasn't encrypted using the key. (We didn't use the hash message in this case).
Case 2: If someone has the key, they intercept the message of Alice and modify it to
m2 then they encrypt and hash the new message and send it as
(encrypt(m2),hash(m2)). When bob tries to verify the integrity of the message, the process will succeed (in this case using the hash didn't help to check the integrity of the message).
So in both cases the hashed message is not (or cannot) be used to check the integrity of the message.
Is this correct? Because I have argued with my teacher and he said that hashing the message helps to check for integrity in both symmetric and asymmetric encryption.
Is there some cases that hashing the message is useful?