Hashlib
This module provides access to a variety of cryptographic hash algorithms. These are mathematical functions that take a message of any size and produce a fixed size result, which is referred to as a hash or digest. Cryptographic hashes have many uses, from verifying data integrity to securely storing and verifying passwords.
Ideally, cryptographic hash algorithms should be:
- Deterministic: The same message should always produce the same hash.
- Irreversible: It should not be feasible to determine the original message from the hash.
- Collision resistant: It should be hard to find two different messages that produce the same hash.
These properties are crucial for the secure application of hashes. For example, it is considered imperative that passwords are only stored in hashed form. The irreversibility property ensures that even if a data breach occurs and an attacker gets hold of your password database, it would not be feasible for them to obtain...