The hashlib module defines an API for accessing different cryptographic hashing algorithms. To work with a specific hash algorithm, use the appropriate constructor function or new() to create a hash object. From there, the objects use the same API, no matter what algorithm is being used.
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.