I was recently studying about Message Authentication Code (MAC) and Hashed based Message Authentication Code( HMAC).
What I understood is MAC takes the message and a shared secret key and applies the MAC algorithm and the output is appended with the original message and sent to the server and the server uses the same key, message and applies the MAC algorithm and matches the output of the algorithm with the one appended to the packet received. If both of them matches then the data is not tampered and comes from a good source.
While in the HMAC, the message is hashed using MD5 or SHA algorithms and the output of the hash is appended with the shared key and again hashed and this output is appended with the message and sent to the server and the server also uses the same methods to see if the message is tampered or not.
But how is HMAC better than MAC? it just includes another round of hashing.