Available Hashing Algorithms
suggest changehashlib.new requires the name of an algorithm when you call it to produce a generator. To find out what algorithms are available in the current Python interpreter, use hashlib.algorithms_available:
import hashlib
hashlib.algorithms_available
# ==> {'sha256', 'DSA-SHA', 'SHA512', 'SHA224', 'dsaWithSHA', 'SHA', 'RIPEMD160', 'ecdsa-with-SHA1', 'sha1', 'SHA384', 'md5', 'SHA1', 'MD5', 'MD4', 'SHA256', 'sha384', 'md4', 'ripemd160', 'sha224', 'sha512', 'DSA', 'dsaEncryption', 'sha', 'whirlpool'}
algorithms_available is a set, not a list. It varies by platform and interpreter. The set above is an old snapshot, not this interpreter. Make sure you check your algorithm is available.
There are also some algorithms that are guaranteed to be available on all platforms and interpreters, which are available using hashlib.algorithms_guaranteed:
hashlib.algorithms_guaranteed
# 3.14 also guarantees blake2b, blake2s, sha3_224, sha3_256, sha3_384,
# sha3_512, shake_128, and shake_256, along with md5, sha1, sha224,
# sha256, sha384, and sha512. The older transcript listed only the last six.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents