Difference Between MD4 and MD5 encryption

Aykut Aktaş
Innovile
Published in
2 min readFeb 16, 2022

--

MD4 & MD5 Encryption Algorithms

MD4 and MD5 are not encryption algorithms. They are one-way hash function designed for cryptography. It is important you understand the difference.

MD5 is a slightly modified version of MD4 that improves its security somewhat.

Another thing that is important to understand is that neither of these function are considered safe for use in cryptography: MD4 has been considered very insecure since the beginning of the 90’s and MD5 is known to be insecure since the beginning of the 2000's.

Unless you really have to use these function for compatibility reasons, do not use them in your code, especially MD4.

If you can, use one of the SHA-2 variants (.NET Framework implements all of them) or, if you can’t, at least use SHA-1 temporarily, which is theoretically vulnerable but for which there is no practical attack yet.

However, you need to understand that support for SHA-1 is going away in many systems pretty soon as well.

MD5 is merely an egregiously broken cryptographic hash function, whereas MD4 is a comically, egregiously mega-broken cryptographic hash function. (3DES is a bit broken too FWIW.)

The difference between MD4 and MD5 probably doesn’t matter. We using the hash for cryptographic purposes. You can just using it as a utility key derivation function to get from a variable-length password to a fixed-width byte array suitable for use as key material.

Conclusion:
If this is a real application you should probably consider using some existing known-good cryptosystem instead. See the oft-quoted If You’re Typing The Letters A-E-S Into Your Code…, whose “bad” example is almost exactly what you’re doing.

MD4 : https://github.com/mono/mono/blob/main/mcs/class/Mono.Security/Mono.Security.Cryptography/MD4Managed.cs

MD5 :
https://github.com/reactiveui/Akavache/blob/main/src/Akavache.Core/Platforms/shared/MD5Managed.cs

--

--