Open In App
Related Articles

HMAC Algorithm in Computer Network

Improve Article
Improve
Save Article
Save
Like Article
Like

HMAC algorithm stands for Hashed or Hash-based Message Authentication Code. It is a result of work done on developing a MAC derived from cryptographic hash functions. HMAC is a great resistance towards cryptanalysis attacks as it uses the Hashing concept twice. HMAC consists of twin benefits of Hashing and MAC and thus is more secure than any other authentication code. RFC 2104 has issued HMAC, and HMAC has been made compulsory to implement in IP security. The FIPS 198 NIST standard has also issued HMAC. 

Objectives – 

  • As the Hash Function, HMAC is also aimed to be one way, i.e, easy to generate output from input but complex the other way round. 
  • It aims at being less affected by collisions than the hash functions. 
  • HMAC reuses the algorithms like MD5 and SHA-1 and checks to replace the embedded hash functions with more secure hash functions, in case found. 
  • HMAC tries to handle the Keys in a more simple manner. 
     

HMAC algorithm – 
The working of HMAC starts with taking a message M containing blocks of length b bits. An input signature is padded to the left of the message and the whole is given as input to a hash function which gives us a temporary message-digest MD’. MD’ again is appended to an output signature and the whole is applied a hash function again, the result is our final message digest MD. 

Here is a simple structure of HMAC: 

 

Here, H stands for Hashing function, 
M is the original message 
Si and So are input and output signatures respectively, 
Yi is the ith block in original message M, where I ranges from [1, L) 
L = the count of blocks in M 
K is the secret key used for hashing 
IV is an initial vector (some constant) 
The generation of input signature and output signature Si and So respectively. 

 

To a normal hash function, HMAC adds a compression instance to the processing. This structural implementation holds efficiency for shorter MAC values.
 

Unlock the Power of Placement Preparation!
Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.
Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation course.

Last Updated : 02 Nov, 2021
Like Article
Save Article
Previous
Next
Similar Reads