HMAC or Hash-based Message Authentication Code is used for verifying the data integrity and the authenticity of a message. It uses symmetric key cryptography. Using a hash algorithm and a symmetric secret key a Message Authentication Code or MAC is generated. The MAC is attached to the message and sent to a recipient. The recipient can use the same secret key to verify the MAC. On successful verification, the recipient can be sure that the sender indeed has sent the message and the message is unmodified after it is sent. Please note that digital signatures use asymmetric cryptography where HMAC uses symmetric key cryptography.
There are several modules in Python that can be used for generating HMAC. We have already discussed how to use HMAC in Python using the hmac and hashlib libraries in this article: How to use HMAC in Python? In this article, we would discuss how to implement the HMAC algorithm in Python.
0 Comments