MD2, MD4 and MD5
Ron Rivest's message-digest hashes; all three are broken and kept for legacy use
Overview
MD2, MD4 and MD5 are 128-bit hash functions designed by Ron Rivest between 1989 and 1992. MD5 was once ubiquitous, but all three now have practical collision attacks and none should be used for security purposes.
MD4 (RFC 1320) introduced the fast 32-bit Merkle–Damgård design that later shaped MD5, SHA-1 and SHA-2: 512-bit blocks, a small state of 32-bit words and rounds of boolean functions, additions and rotations. MD5 (RFC 1321) added a fourth round and other strengthening for safety margin. MD2 (RFC 1319) is an older byte-oriented design for 8-bit machines, built on a 256-byte substitution table and a checksum block appended to the message.
Collisions for MD4 can be found by hand-scale computation. MD5 collisions were published by Wang and colleagues in 2004, and chosen-prefix collisions were used to forge a rogue CA certificate in 2008 and in the Flame malware in 2012. MD2 has preimage and collision attacks well below generic bounds. All three remain in NextSSL so that legacy formats, NT hashes and old checksums can be computed and verified.
History
1989–2008MD2 published by Ron Rivest
MD4 published
MD5 published as RFC 1321
Specified in RFC 1319
Specified in RFC 1320
Wang et al. publish practical MD5 collisions
Rogue CA certificate built with an MD5 collision
Security notes
All three are cryptographically broken. MD5 and MD4 collisions are practical in seconds, and MD5 chosen-prefix collisions have been exploited in real attacks. Use them only to interoperate with existing data, never for signatures, certificates or integrity against an adversary.
Typical uses
Variants in NextSSL
3Frequently asked questions
Which MD2, MD4 and MD5 variants does NextSSL include?
NextSSL registers 3 MD2, MD4 and MD5 variants: md2, md4, md5.
Families with similar names
Other hash functions
All 424Related
NIST SP 800-90A deterministic random bit generator built on HMAC
NT hashThe Windows NTLM password hash: unsalted MD4 of the UTF-16 password
SHA-1 and SHA-0The 160-bit NIST hash with practical collisions since 2017; kept for compatibility
SHA-2The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
HMACThe standard way to build a MAC from a cryptographic hash (RFC 2104, FIPS 198-1)