Skip to content

What is MD5 encryption?

Concept of MD5 encryption explained

MD5 (Message-Digest Algorithm 5) is a hash function used to authenticate files and verify data against corruption. It was developed in 1992 and used for a long time as a cryptographic hash function, but since 2005 it’s been considered less secure.

What is MD5 encryption, and if MD5 isn’t recommended for cybersecurity anymore, why is it still being used? Are there other hash functions that have taken its place? Find out in this guide to MD5 encryption.

A programmer working on his laptop and PC coding

MD5 is a hash function — not encryption

First things first: MD5 isn’t encryption; it’s a hash function. What’s the difference? When you encrypt something, you can always decrypt it. Encrypted data gets scrambled while it’s in transit, and the recipient can only unscramble it to read the real message if they have a key.

A hash function, on the other hand, never changes. A hash is used as a unique identifier for a particular message. You can tell two messages or two pieces of data apart by looking at their hash codes — and if someone has tried to tamper with the message, you’ll be able to tell.

The goal of encryption is confidentiality. The goal of a hash function is data integrity.

What are hash functions used for?

You don’t have to go far to find a hash function in use. In the book Serious Cryptography, author Jean-Philippe Aumasson refers to them as a sort of Swiss Army Knife due to their versatility. 

Hash functions are used to:

  • Create digital signatures
  • Identify identical files and detect modified files in cloud storage systems
  • Identify files in a Git repository
  • Detect modified files in host-based intrusion detection systems (HIDS)
  • Detect known malicious data going through a network
  • Prove digital artifacts have not been modified
  • Provide a proof-of-work system for Bitcoin
  • Create a unique identifier for non-fungible tokens (NFTs)

What is the purpose of an MD5 file?

MD5 is a hash function used to authenticate files. You can use MD5 to create a sort of digital fingerprint of a file. In theory, there should be an unlimited number of MD5 hash codes that can be assigned, so no two files will have the same one.

MD5 allows you to compare two files against each other to see if they have the same hash. It uses a 128-bit algorithm to assign a hash to a file. MD5 used to be used for security, but in the last several years is more for preserving the integrity of files and images.

The Advantages of MD5

Using MD5 has several benefits when it comes to data integrity and authentication:

  • It’s much easier to compare hashes between files.
  • You can store passwords in a 128-bit format.
  • You can check for file corruption by comparing hash values before and after data transmission.

The Disadvantages of MD5 Encryption

Although MD5 has its uses, it’s not the most powerful hash algorithm available today. Since 2005, MD5 has been considered “broken.” It produces 128-bit hashes, but algorithms like SHA-256 produce 256-bit hashes. That means more powerful algorithms like SHA can generate more unique identifiers than MD5.

Also, a team of Chinese scientists found a way to calculate when the MD5 algorithm would generate the same hash for two different files — known as hash collision. Hash collision defeats the purpose of MD5, which is an authentication tool. If two files have the same hash and they’re not supposed to, it’s a problem. If you can calculate and therefore predict when this collision will happen, it’s a bigger problem.

For this reason, MD5 encryption isn’t considered as secure as it used to be. However, it’s still often used for authentication for system compatibility reasons.

A person coding on a macbook pro

Can you decrypt MD5?

Technically, no, you cannot decrypt MD5 because it’s not an encryption algorithm. It’s a hash function. Once a hash is created, it can’t be modified. You cannot use a hash to determine what was in the original file or message.

How to “Crack” MD5: An Example

Let’s say you created a file that says “Hello world.” You then use MD5 or another hash function to hash your “Hello world” file. You get a string of letters and numbers — this is the unique identifier for your file. If you send the hash of your file to someone else, or someone finds a way to take it from you, they won’t be able to unlock your file. If all they have is the hash code, they won’t know what the original file says at all.

What someone can do is use MD5 on their own files to see if it spits out the same hash code. They can try this over and over again with a different file each time. Maybe one says “Hi world” and another “Goodbye” or another “Hey there.” They can hash each of these files, hoping that eventually, they’ll get a code that is exactly the same as your original “hello world” file. They would then be able to read your file.

It might happen that the person trying to “crack” your hashed file does come up with the same code using this guess-and-test method. And it could be your file. Or it could be a different file; the hash function has generated the same identifier for two different files. Why does that happen? The algorithm wasn’t strong enough to produce plenty of unique identifiers to go around. This is called hash collision.

Is MD5 still safe?

MD5 is no longer considered a secure method for cryptographic authentication. It only takes a few seconds to find hash collisions for MD5, meaning you can find an instance of the same hash being used for two different files. Since the purpose of MD5 is verifying the integrity of unique files, being able to find a collision that easily makes it less safe to use.

That doesn’t mean the world has completely phased out MD5, though. You’ll still find that it’s used in lots of places, like password hashing and storage for developers.

What to Use Instead of MD5

You can use the SHA-2 or SHA-3 family of algorithms rather than MD5. The National Institute of Standards and Technology (NIST) in the US considers these algorithms more secure, more resistant to potential collisions, and more able to generate truly unique hash values than MD5.

The SHA-2 family of algorithms includes:

  • SHA-256
  • SHA-224
  • SHA-384
  • SHA-512
  • SHA-512/224
  • SHA-512/256

The SHA-3 algorithms includes:

  • SHA3-224
  • SHA3-256
  • SHA3-384
  • SHA-512

Everything You Need to Know About MD5

So what is MD5 encryption? Once upon a time, MD5 was a secure way to authenticate information. Times and technology change, and it’s no longer considered safe. But sometimes technology can change faster than we want it to, and so MD5 is still pretty widely used.

Related Articles

  • All
  • Easy Prey Podcast
  • General Topics
  • Home Computing
  • IP Addresses
  • Networking Basics: Learn How Networks Work
  • Online Privacy
  • Online Safety
  • Uncategorized
Popular VPN services that typically offer the option to choose your location

Top VPNs That Let You Choose Your Location

Did you know that all VPNs change your location, and many of them let you choose your…

[Read More]
Torrent download using CyberGhost VPN

Should I Use CyberGhost VPN for Torrenting?

The chaotic sea of the Internet offers so much content and interactive opportunities, it can feel overwhelming….

[Read More]
If you get caught in a scam, don't panic - follow these steps for what to do if you fell for a scam.

What to Do If You Fell for a Scam: A Comprehensive Guide

So you fell for a scam. It can happen to anybody. No matter how smart, capable, aware,…

[Read More]
Craig Davies talks about the challenges of onboarding and offboarding employees in a smooth and secure way.

Making the Employee Onboarding and Offobarding Process Easier and More Secure

Fifty years ago, it wasn’t very common for employees to change jobs. Once they were hired, they…

[Read More]
Ensure the VPN service is compatible with your PlayStation device.

How to Choose the Right VPN for PlayStation

Adults and kids alike enjoy hours submersed in the adventures of online gaming. You can network and…

[Read More]
Verify if online sources are legit

8 Ways To Tell if an Online Source is Legit

In the digital age, the amount of information at our fingertips is staggering. Between newspaper and magazine…

[Read More]