What exactly is the Hashed Message Authentication Code, or HMAC for short?
A particular variety of message authentication code (MAC), referred to as HMAC (sometimes expanded as either keyed-hash message authentication code or hash-based message authentication code), is comprised of a cryptographic hash function and a secret cryptographic key. HMAC is sometimes expanded as either keyed-hash message authentication code or hash-based message authentication code. It is possible to use it to validate simultaneously the data integrity and the validity of a message, similar to how any MAC may be used. Instead of utilizing digital signatures with asymmetric cryptography, HMAC can enable authentication by utilizing a shared secret between the parties. Delegating the key exchange to the parties that are communicating eliminates the requirement for a complicated public key infrastructure. The communicating parties are then responsible for establishing and utilizing a trusted channel in order to agree on the key prior to communicating with one another.