This question already has an answer here:
I understand what a hash is, basically we calculate a hash and append it to the message and send it to the receiver. If someone alters the message, the receiver will know because there would be a different hash value.
Since hash algorithms are well-known such as MD5, SHA1, if there is a man in the middle attack, can he then alter the message and regenerate the hash based on the altered message and send it to the receiver? The receiver will not know it is an altered message by calculating the hash, correct?