Integrity compromised - HASH modified As we are all aware that HASHing is user to verify integrity in cryptography. I have a query about hashing.

Suppose a man in the middle attacker manipulates the data and creates new HASH (by running algorithm on manipulated data) using the same hashing algorithm (becausehashing algorithms are universal algorithms) and send it along with the manipulated data to the receiver.when receiver runs the algorithm on manipulated data, it gets the same HASH ( HASH created by the attacker) and though integrity will be verified. But actual data has been manipulated/modified and integrity is compromised.

Is it possible? and if it is possible how can we eliminate this problem (solution for the same)?
Indeed hashing is used to ensure integrity, but not this way.

What you have in mind it seems is sending (msg, Hash(msg)). Indeed this is not secure because of the attack you describe.

The first step starts with something you say by yourself:


  hashing algorithms are universal algorithms


The name is not univesal but public, it means anyone knows it.
Instead of a hashing algorithm we will use a MAC (Wikipedia:MAC), which a hashing algorithm with a key. A well-spread MAC construction is HMAC: HMAC(msg,key1,key2) = H( key1 || H(key2||msg) ) where H is a cryptographic hash and || is concatenation.

If we prevent the adversary from knowing the key we used, he cannot re-compute the MAC after he modified the message.
So now we only need privacy on the MAC key, which is another challenge, you can solve it with a Key-Exchange protocol (typically: Diffie-Hellman), probably with authentication if you have a Man-In-The-Middle, and so on ...