Miklix

MD4 Hash Code Calculator

Published: February 10, 2025 at 4:25:51 PM UTC

Hash code calculator that uses the Message Digest 4 (MD4) hash function to calculate a hash code based on text input or file upload.

MD4 (Message Digest 4) is a cryptographic hash function designed by Ronald Rivest in 1990. It produces a fixed 128-bit (16-byte) hash value from an input of arbitrary length. MD4 is now considered cryptographically broken due to vulnerabilities that allow for collision attacks (finding two different inputs that produce the same hash), so it should not be used when designing new systems. It is included here in case one needs to generate a backwards compatible hash code.

Full disclosure: I did not write the specific implementation of the hash function used on this page. It is a standard function included with the PHP programming language. I only made the web interface to make it publicly available here for convenience.


Calculate New Hash Code

Data submitted or files uploaded through this form will only be kept on the server for as long as it takes to generate the requested hash code. It will be deleted immediately before the result is returned to your browser.

Input data:



Submitted text is UTF-8 encoded. Since hash functions operate on binary data, the result will be different than if the text was in another encoding. If you need to calculate a hash of a text in a specific encoding, you should upload a file instead.



About the MD4 Hash Algorithm

I'm not a mathematician, so I'll try to explain this hash function in a way that my fellow non-mathematicians can understand ;-) If you prefer the math-heavy explanation, you can find that on plenty of other websites.

Okay, so think of MD4 as a special paper shredder. But instead of shredding paper, it "shreds" any message (like a letter, a password, or a book) into a small, fixed-size receipt. No matter how big or small your message is, this shredder always gives you a tiny receipt that's exactly 16 bytes (128 bits) long, or 32 characters in hexadecimal form.

To get the message shredded correctly, you need to go through four steps:

Step 1: Preparing the Message

  • Before shredding, you have to adjust your paper to fit into the shredder perfectly.
  • If your message is too short, you add some extra blank space (like doodles or filler) so the paper fits just right.
  • If it's too long, you split it into multiple pages of the same size.

Step 2: Adding a Secret Stamp

  • After adjusting the message, you add a secret stamp at the end that says how long the original message was.
  • This helps the shredder keep track of the message’s original size, no matter how much filler you added.

Step 3: The Shredding Process (3 Rounds of Magic)

  • Now the message goes into the shredder.
  • The shredder has 4 gears (A, B, C, and D) that spin together in a special pattern.
  • The gears go through 3 rounds of spinning, where they:
    • Mix the words
    • Flip some parts upside down
    • Twist them around like a Rubik's cube
    • Smash different pieces together
  • Each round makes the message look more and more like a jumbled mess that’s impossible to recognize.

Step 4: The Final Receipt

  • After all the spinning, flipping, and smashing, the shredder spits out a receipt - a short string of numbers and letters (the hash).
  • This receipt is always the same length, no matter if you shredded a single word or an entire book!

Unfortunately, over time, people discovered that this magical shredder isn't perfect. Some clever folks figured out how to trick the shredder into giving the same receipt for two different messages (this is called a collision) and to predict how the gears will spin and then use it to create fake receipts. Because of this, MD4 is no longer considered secure for important stuff.

Share on BlueskyShare on FacebookShare on LinkedInShare on TumblrShare on XShare on LinkedInPin on Pinterest

Mikkel Bang Christensen

About the Author

Mikkel Bang Christensen
Mikkel is the creator and owner of miklix.com. He has over 20 years experience as a professional computer programmer/software developer and is currently employed full-time for a large European IT corporation. When not blogging, he spends his spare time on a vast array of interests, hobbies, and activities, which may to some extent be reflected in the variety of topics covered on this website.