In brief
HMAC combines a message, a secret key and a chosen hash algorithm. A recipient holding the same key can calculate the expected code and compare it with hmac.compare_digest().
Useful to know
HMAC combines a message, a secret key and a chosen hash algorithm. A recipient holding the same key can calculate the expected code and compare it with hmac.compare_digest(). [1]
This does not encrypt the content. Visible text remains visible, and confidentiality needs a separate mechanism. Distinguish checking integrity from hiding data, and keep the key out of public source code and logs.
Sources
For further detail and to check the information: