MD2 Hash Generator

Produce the 128-bit MD2 digest defined in RFC 1319, as 32 hexadecimal characters.

Text
MD2 digest
Runs locally in your browser

About the MD2 Hash Generator

MD2 was published by Ronald Rivest in 1989 and was designed for machines with 8-bit registers, which is why every operation in it works on single bytes rather than 32-bit words. The message is padded so its length is a multiple of 16, a 16-byte checksum is appended, and then a 48-byte state is stirred through 18 rounds per block using a fixed permutation table derived from the digits of pi. The result is 128 bits printed as 32 hexadecimal characters.

You are most likely to meet it in old certificates. MD2 with RSA was a valid signature algorithm in early X.509 practice, and a handful of long lived root certificates were signed that way, which is why the identifier still appears in parsing libraries. It is comprehensively broken today: a preimage attack published in 2008 runs far below the theoretical cost, collisions were shown in 2004, and no protocol should choose it now. Treat this page as a compatibility and archaeology tool rather than a security one.

Because MD2 is rarely bundled, results are easy to doubt, so the sample here is the string message digest, whose RFC 1319 digest is ab4f496bfb2a530b219ff33031fe06b0. Every vector in that document reproduces exactly. Text is encoded as UTF-8 before hashing, the digest can be shown in either hex case or Base64, and everything happens on your own machine. For a digest of the same length that is still useful for cache keys and deduplication, see the MD5 Hash Generator, and if you are trying to work out what produced a 32 character string, the Hash Identifier lists the candidates.

How to use

  1. Paste the text you want to run through MD2 into the left pane.
  2. Compare the sample against ab4f496bfb2a530b219ff33031fe06b0 to confirm the implementation matches RFC 1319.
  3. Switch the output to Base64 if the digest is going into a certificate field or an XML document.
  4. Copy the 32 character result.

Common questions

Is MD2 still safe to use?
No. Practical collisions were demonstrated in 2004 and preimage work followed, so it must not protect anything. It survives only for reading legacy certificates and archived data.
Why is MD2 so slow compared with MD5?
It processes one byte at a time through a substitution table and runs 18 rounds over a 48-byte state per block, a design aimed at 8-bit hardware rather than modern word sized processors.
How long is an MD2 digest?
One hundred and twenty eight bits, written as 32 hexadecimal characters or 24 characters in Base64 including the padding.
Does the checksum block affect the result?
Yes. MD2 appends a 16-byte checksum of the padded message and hashes that block too, so changing any byte changes both the checksum and the digest.