Since MD5 violates the one-way constraint, we must pick a more suitable cryptographic hash function. There are a myriad of hashing algorithms available. Here's a list of some of the most popular ones: MD4, MD5, MD6, SHA1, SHA2 series (including SHA256, SHA512), SHA3 series (including SHA3-512, SHAKE256), RIPEMD, HAVAL, BLAKE2, RipeMD, WHIRLPOOL, Argon2, PBKDF2, and bcrypt.
MD5 and SHA-1 were extremely popular when they were introduced, and were seen as robust cryptographic hashing algorithms at the time, but have since been replaced by more modern cryptographic hash functions such as PBKDF2 and bcrypt.
Algorithms can become unsuitable due to the following factors:
- Collisions can be engineered: Collisions are inevitable, and given enough time and resources, the original message can be brute-forced from the hash.
However, if someone can purposefully engineer two different messages to produce the same hash, this means they could potentially authenticate another user without knowing the password. This usually requires a lot of computing power and time.
Thus, an algorithm can be assumed to be collision-resistant if it would take an unworldly amount of time/resources to generate a collision, so that the information they may potentially obtain is not worth the time and resources they must invest into obtaining it.
However, since cryptography plays such a fundamental role in security, cryptographic hashing algorithms are heavily analyzed in academia. Often, researchers would intentionally try to generate collisions in algorithms (both MD5 and SHA-1 were dethroned in this fashion). - Advances in processing speeds: Cryptographic algorithms are meant to be slow. If the speed of processors increases, it means a malicious party can spend less time/resources to crack a password. Eventually, advances in processing speed can make an algorithm unsuitable.
To mitigate collisions, an algorithm should be complex enough and hard to reverse-engineer. It should also produce a digest of sufficient length to reduce the probability of collision (it would be harder to generate collisions for 1024-bit digests than for, say, 128-bit digests).
To mitigate the advances in processing speeds, modern algorithms employ a method called hash stretching (such as key stretching), which allows the algorithm to dynamically change the speed of the algorithm.