Reputation: 666
During coding, I have used both MD4 and MD5 encryption techniques. But there hasn't been any noticeable security difference between either of them. And yet, most of them prefer MD5, in fact specify it. MD5 :
System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding();
MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider();
byte[] TDESKey = null;
TDESKey = HashProvider.ComputeHash(UTF8.GetBytes("CXPUB001")); // ASYNC PRIVATE KEY CODE FOR DATA ENCRYPTION
//DATA ENCRYPTION
TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider();
TDESAlgorithm.Key = TDESKey; //SENDER KEY APPENDED
TDESAlgorithm.Mode = CipherMode.ECB;
TDESAlgorithm.Padding = PaddingMode.PKCS7;
byte[] DataToEncrypt = UTF8.GetBytes(Message);
So, what is the difference, security wise, between using MD4 and MD5 ?
Upvotes: 0
Views: 2583
Reputation: 2397
Both MD4 & MD5 are not encryption, they are a hash function that produce a 128-bit hash value. If you need encryption, use a proper encryption technology like AES
And to add on to the "security" aspect of MD5, it has been declared as non usable due to several vulnerabilities that can result in hash collision, and worst still, reversing the ciphertext back to their original values using rainbow tables. If you need hashing, use SHA-2
Upvotes: 2
Reputation: 5008
MD5 was designed in 1991 to be a secure replacement. (Weaknesses were indeed later found in MD4 by Hans Dobbertin
The security of MD4 has been severely compromised. The first full collision attack against MD4 was published in 1995 and several newer attacks have been published since then. As of 2007, an attack can generate collisions in less than 2 MD4 hash operations.
The following are the differences between MD4 and MD5:
A fourth round has been added.
Each step now has a unique additive constant.
The function g in round 2 was changed from (XY v XZ v YZ) to (XZ v Y not(Z)) to make g less symmetric.
Each step now adds in the result of the previous step. This promotes a faster "avalanche effect".
The order in which input words are accessed in rounds 2 and 3 is changed, to make these patterns less like each other.
The shift amounts in each round have been approximately optimized, to yield a faster "avalanche effect." The shifts in different rounds are distinct.
Upvotes: 1