A deep dive into common hash algorithms
In this section, we’ll take a closer look at some common hash algorithms that are frequently employed in various applications, including security, data integrity verification, and password hashing. Here, we’ll explore the characteristics and typical usage scenarios of MD5, SHA-1, SHA-256, and Bcrypt.
MD5
Message Digest Method 5 (MD5) is a cryptographic hash algorithm that transforms a string of any length into a 128-bit digest. These digests are represented as hexadecimal integers with 32 digits. Developed by Ronald Rivest in 1991, this algorithm can verify digital signatures.
Practical example
A complete re-implementation of hash functions is not the goal of this chapter. Instead, we will consider a simple example of an MD5 hash. The full source code for the PoC in Python looks like this:
import hashlib def calc_md5(data): md5_hash = hashlib.md5() md5_hash...