hashlib.pbkdf2_hmac()

hashlib.pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None) The function provides PKCS#5 password-based key derivation function 2. It uses HMAC as pseudorandom function. The string hash_name is the desired name of the hash digest algorithm for HMAC, e.g. ‘sha1’ or ‘sha256’. password and salt are interpreted as buffers of bytes. Applications and libraries should limit password to a sensible length (e.g. 1024). salt should be about 16 or more bytes from a proper source, e.g. os.uran

hashlib.hash.hexdigest()

hash.hexdigest() Like digest() except the digest is returned as a string object of double length, containing only hexadecimal digits. This may be used to exchange the value safely in email or other non-binary environments.

hashlib.new()

hashlib.new(name[, data]) Is a generic constructor that takes the string name of the desired algorithm as its first parameter. It also exists to allow access to the above listed hashes as well as any other algorithms that your OpenSSL library may offer. The named constructors are much faster than new() and should be preferred.

hashlib.hash.update()

hash.update(arg) Update the hash object with the object arg, which must be interpretable as a buffer of bytes. Repeated calls are equivalent to a single call with the concatenation of all the arguments: m.update(a); m.update(b) is equivalent to m.update(a+b). Changed in version 3.1: The Python GIL is released to allow other threads to run while hash updates on data larger than 2047 bytes is taking place when using hash algorithms supplied by OpenSSL.

hashlib.hash.digest_size

hash.digest_size The size of the resulting hash in bytes.

hashlib.hash.copy()

hash.copy() Return a copy (“clone”) of the hash object. This can be used to efficiently compute the digests of data sharing a common initial substring.

hashlib.hash.digest()

hash.digest() Return the digest of the data passed to the update() method so far. This is a bytes object of size digest_size which may contain bytes in the whole range from 0 to 255.

hashlib.hash.name

hash.name The canonical name of this hash, always lowercase and always suitable as a parameter to new() to create another hash of this type. Changed in version 3.4: The name attribute has been present in CPython since its inception, but until Python 3.4 was not formally specified, so may not exist on some platforms.

hashlib.hash.block_size

hash.block_size The internal block size of the hash algorithm in bytes.

hashlib.algorithms_guaranteed

hashlib.algorithms_guaranteed A set containing the names of the hash algorithms guaranteed to be supported by this module on all platforms. New in version 3.2.