O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

hmac

The hmac module provides support for HMAC (Keyed-Hashing for Message Authentication). HMAC is a mechanism used for message authentication that is built upon cryptographic hashing functions such as MD5 and SHA-1.

						new(key
						[,
						msg
						[,
						digest]])

Creates a new HMAC object. key is a string containing the starting key for the hash, msg contains initial data to process, and digest is a module that should be used for cryptographic hashing. By default, digest is md5. Normally, the initial key value is determined at random using a cryptographically strong random number generator.

An HMAC object, h, has the following methods:

						h.update(msg)

Adds the string msg to the HMAC object.

						h.digest()

Returns the digest of all data processed so far and returns ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required