hashlib the hashlib module implements variety of secure hash and message digest algorithms such as md and sha to compute hash valueyou start by calling one of the following functionsthe name of which is the same as represented algorithmfunction description md (sha (sha (sha (md hash ( bitssha hash ( bitssha hash ( bitssha hash ( bitssha hash ( bitssha hash ( bitssha (sha (an instance of the digest object returned by any of these functions has the following interfacemethod or attribute description update(dataupdates the hash with new data data must be byte string repeated calls are the same as single call with concatenated data returns the value of the digest as raw byte string returns text string with the value of the digest encoded as series of hex digits returns copy of the digest the copy preserves the internal state of the original digest size of the resulting hash in bytes internal block size of the hash algorithm in bytes digest( hexdigest( copy( digest_size block_size an alternative construction interface is also provided by the modulenew(hashnamecreates new digest object hashname is string such as 'md or 'sha specifying the name of the hashing algorithm to use the name of the hash can minimally be any of the previous hashing algorithms or hashing algorithm exposed by the openssl library (which depends on the installationhmac the hmac module provides support for hmac (keyed-hashing for message authentication)which is described in rfc- hmac is mechanism used for message authentication that is built upon cryptographic hashing functions such as md and sha- new(key [msg [digest]]creates new hmac object herekey is byte string containing the starting key for the hashmsg contains initial data to processand digest is the digest constructor that should be used for cryptographic hashing by defaultdigest is hashlib md lib fl ff