MD5
MD5 is a 128-bit cryptographic hash function designed by Ronald Rivest; proven insecure by collision attacks, it is now used only for non-security purposes such as checksums.
Purpose
Provides a fast message digest for integrity checking, but is no longer suitable for security purposes due to collision attacks.
Mechanism
Processes input in 512-bit blocks, maintaining a 128-bit state (four 32-bit words). Each block goes through 4 rounds of 64 steps of nonlinear transforms (F/G/H/I) updating the state. Outputs the final 128-bit state. Collisions can be constructed in seconds.
Use cases
- File download checksums (non-security)
- ETag cache keys
- Legacy system checksums (non-security)
- Teaching examples (hash principles)
Examples
- Input
helloOutput5d41402abc4b2a76b9719d911017c592128 bits = 32 hex characters
Common errors
- Using MD5 to store passwords or make digital signatures
- Use SHA-256 or bcrypt
Related terms
SHA-1
SHA-1 is a 160-bit cryptographic hash function designed by the NSA; Google published the SHAttered collision in 2017, and it has been deprecated across standards. GLOSSARY
SHA-256
SHA-256 is the 256-bit-output member of the SHA-2 family, widely used in TLS, blockchains, and cryptographic applications, with no known practical attacks. GLOSSARY
Collision Resistance
Collision resistance is the property of a hash function that it is infeasible to find two distinct inputs producing the same hash output. The birthday attack dictates the required output length. GLOSSARY
Rainbow Table
A rainbow table is a precomputed table improved by Martin Hellman for inverting hash functions, trading space for time in a time-space trade-off to crack password hashes. GLOSSARY