FormatterHQ

MD2 Hash Generator

Calculate MD2 digests of text or files — for legacy systems, old certificates and test vectors. MD2 is obsolete and must not be used for security.

Loading tool…
Ready.

How to use the MD2 Hash Generator

  1. Type or paste text into the input box, or switch the source to File and choose a file — it is hashed locally, never uploaded.
  2. Read the main hash at the top — the table below shows the same input under every other common algorithm. Tick Uppercase hex if you need capitals.
  3. To verify a value, paste it into Compare with an expected hash — the tool reports a match, or which algorithm it matches instead. Copy any row with its Copy button.

MD2 hash generator for legacy work

MD2 is the first of Ron Rivest’s “Message Digest” functions, published in 1989 and specified in RFC 1319. This MD2 hash generator computes the 128-bit MD2 digest of any text or file and prints it as 32 hexadecimal characters. It is implemented directly from the RFC, because MD2 is so old that most modern crypto libraries no longer include it.

Example

Input:

The quick brown fox jumps over the lazy dog

MD2:

03d85a0d629d2c442e987525319fc471

The MD2 of an empty string is 8350e5a3e24c153df2275c9f80692773 — a standard test vector from RFC 1319 that you can use to confirm any implementation.

Algorithm at a glance

PropertyValue
Digest size128 bits (32 hex characters)
Block size16 bytes
DesignedRonald Rivest, 1989 (RFC 1319)
DesignByte-oriented, with a 256-entry substitution table derived from the digits of π and an appended checksum
StatusObsolete; RFC 6149 moved MD2 to Historic status in 2011

How MD2 works

MD2 was designed for the 8-bit computers of its time, so it works one byte at a time rather than on 32-bit words. The message is padded to a multiple of 16 bytes, a 16-byte checksum is appended, and then each block is mixed into a 48-byte state over 18 rounds using the π-based substitution table. The first 16 bytes of the final state are the digest. This byte-by-byte design makes MD2 very slow compared with later hashes.

Security status

MD2 is broken and must not be used to protect anything. Researchers have published preimage attacks that are far faster than brute force and collision attacks against its compression function, and it has been deprecated for digital signatures for many years. Its 128-bit output is also too short by modern standards.

Legitimate uses today

  • Reading or verifying very old X.509 certificates and PKCS #1 signatures that used md2WithRSAEncryption.
  • Testing parsers, forensic tools and crypto libraries against published MD2 test vectors.
  • Teaching the history of hash function design.

For new work, use SHA-256 or SHA3-256. If you only need a fast checksum to detect accidental changes, CRC-32 is far quicker. For passwords, use a dedicated password hash such as bcrypt instead of any general-purpose hash.

Hashing runs locally in your browser; text and files are not uploaded.

Computing MD2 in other tools

When you need to reproduce a legacy MD2 value in code, support is patchy:

  • PHP: hash('md2', $data) is still available in the standard hash extension.
  • Java: MessageDigest.getInstance("MD2") works with the default provider.
  • Python: hashlib usually lacks MD2; the PyCryptodome package provides Crypto.Hash.MD2.
  • OpenSSL: MD2 is disabled in standard builds, so openssl dgst -md2 normally fails.

Whatever you use, check it first with the empty-string test vector above. Then use the Compare with an expected hash box here to confirm that both sides agree on a real input.

Frequently asked questions

Is MD2 secure?
No. MD2 has known preimage and collision weaknesses and was moved to Historic status by RFC 6149. Use it only for compatibility with legacy data.
Can an MD2 hash be decrypted?
No hash can be decrypted, because hashing discards information. Short or common inputs can sometimes be found by guessing and comparing, which is why hashes of passwords need special slow algorithms.
Why is MD2 not available in my programming language?
Most modern libraries dropped MD2 because it is obsolete and slow. OpenSSL, for example, disables it by default. Implementations still exist in some legacy and specialised libraries.
What is the MD2 hash of an empty string?
8350e5a3e24c153df2275c9f80692773, the test vector given in RFC 1319.

Last updated September 26, 2026

Related tools

MD4 Hash Generator Generate the MD4 hash of any text or file online. Instant 128-bit digest in hex, computed in your browser. MD5 Hash Generator Generate the MD5 hash of any text or file online. Instant 128-bit digest in hex, computed in your browser. NTLM Hash Generator Generate the Windows NTLM (NT) password hash — MD4 of the UTF-16LE password — online. Password Strength Checker Estimate password entropy and crack time for online and offline attacks, and spot common patterns — checked privately in your browser. PBKDF2 Hash Generator Generate PBKDF2-HMAC-SHA256/512 derived keys and Django-style password hashes with your own salt and iteration count, using WebCrypto. RIPEMD-160 Hash Generator Generate the RIPEMD-160 hash of any text or file online. Instant 160-bit digest in hex, computed in your browser. RSA Key Pair Generator Generate RSA 2048, 3072 or 4096-bit public/private key pairs in PEM (PKCS#8, PKCS#1) or JWK format with WebCrypto, entirely offline. Scrypt Hash Generator Derive scrypt password hashes and keys with custom N, r, p and salt; output as hex, Base64 and common encoded formats. Self-Signed Certificate Generator Create a self-signed SSL/TLS certificate and RSA key for localhost, dev servers or internal tools. Generated locally with WebCrypto. SHA-1 Hash Generator Generate the SHA-1 hash of any text or file online. Instant 160-bit digest in hex, computed in your browser. SHA-2 Hash Generator Generate SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 or SHA-512/256 hashes from text or files. SHA-224 Hash Generator Generate the SHA-224 hash of any text or file online. Instant 224-bit digest in hex, computed in your browser.