Used to ensure the authentication and integrity of information and the confidentiality
Salting is used in hashing for the randomization
MAC - Message Authentication Code
Small Block of data that is generated using a secret key and then appended to the message.
HMAC works with any arbitrary hashing algorithm like SHA256 or MD5. If we use it with SHA 256 then it's called HMAC-SHA256. HMAC Is used to achieve integrity
HMAC Takes Three Input
2) Hash Function
3) Secret (Symmetric Key)
Steps (Sender and Receiver should agree on Hashing Algorithm and the much have the same Symmetric Key.
1) Sender concatenate the Symmetric key (Secret Key) with the Message.
2) Result goes though an hashing algorithm (MD5 or SHA) and a MAC Value is generated
3) The MAC Value is appended to the message
4) Sender Sends the message (With Appended MAC Value) to the receiver
5) Receiver concatenate the Symmetric key with the message
6) Result goes though an hashing algorithm and a MAC Value is generated
7) if Sender MAC Value matches with Receivers MAC Value - Integrity is achieved
Here is a nice website for you to test this process: