MD2
Ron Rivest's message-digest hashes; all three are broken and kept for legacy use
Practical attacks exist. Present for compatibility and research only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About MD2
MD2 is one of 3 MD2, MD4 and MD5 variants in the NextSSL registry, a cryptographic hash function. It produces a 16-byte (128-bit) output. Its registry entry cites RFC 1319. NextSSL lists it in the broken tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
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
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 16 | Output |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'broken' is reachable from the root API only
digest = root.call("hash_with", "md2", None, b"abc")[0]
nextssl_root_hash_with("md2", NULL, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let digest = reg::hash_in(reg::all(), Policy::Any, "md2", &Params::new(), b"abc")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other MD2, MD4 and MD5 variants
2Similar names
Looking for something else?More hash functions
All 424Frequently asked questions
What is MD2?
MD2 is a hash in the MD2, MD4 and MD5 family. MD2, MD4 and MD5 are 128-bit hash functions designed by Ron Rivest between 1989 and 1992.
What are the MD2 sizes?
In NextSSL, MD2 uses: output 16 bytes.
Who designed MD2 and when?
MD2 belongs to the MD2, MD4 and MD5 family, first published by Ron Rivest. Its origin: RFC 1319, RFC 1320, RFC 1321.
Which standards define MD2?
MD2 is referenced by RFC 1319.
Is MD2 safe to use?
MD2 is in the broken tier. Practical attacks exist. Present for compatibility and research only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other MD2, MD4 and MD5 variants are there?
NextSSL also registers md4, md5 in the MD2, MD4 and MD5 family.
Related families
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)