What is the strongest hash algorithm?

Encryption Software, asp Encryption
Buy Now  Download  More Info

There has been a need to conceal messages since the birth of humanity, Cardan grilles are an example of an early hashing equivalent.


It’s no different when you send messages over the internet, to secure messages that you send over the internet you can use a hashing algorithm, these transform a text string into an alphanumeric string. Hashes are typically referred to as one way hashes, this simply refers to the fact that they are very difficult to reverse. It is feasibly impossible for two different messages to be given the same string. If the message is altered then the hash string will become invalid, breaking the seal so to speak. Hashing differs to encryption because the resulting hash is normally smaller than the original, whereas an encrypted document is a similar size.


Encryption and hashing are similar in the way that they both take a string of useful text and convert it into something very different. However you cannot turn a hash value back into its original message since two messages could potentially have the same hash value. As we mentioned before the possibility of two values having the same hash value are very remote, but it is still possible. Encrypted values can be converted back to their original if you know which key, and encryption method was used. The Enigma machine was used to break the German encryption used during world war two. Hash values never need to be decoded, when you log onto your computer the hash value is compared with the hash value stored on your server.


There are many different hashing algorithms available, and we will spend the rest of this paper analysing and comparing the popular hashing algorithms.


SHA Algorithms

The SHA series of algorithms stand for “Secure Hash Algorithm” they were developed by NIST. Due to the avalanche effect even a small change in the data to be encrypted will probably result in a very different hash string. Because the SHA algorithms show signs of the avalanche effect they are believed to have quite a good randomization feature. SHA algorithms were based upon the MD4&5 algorithms developed by Ron Rivest. SHA was released by the national security authority as a US government standard.


SHA-0

SHA-0 is officially known as SHA, it was the first incarnation of the secure hashing algorithm. This first version was withdrawn soon after release due to weaknesses in the design. SHA-1 was released a couple of years later that fixed these problems.


SHA-1

SHA-1 is a popular hashing algorithm released in 1994, it was developed by NIST. SHA-1 is similar to MD4 and MD5 hashing algorithms, and due to the fact that it is slightly more secure than MD4 & MD5 it is considered as MD5’s successor. Saying this, SHA-1 is also slower than MD5.SHA-1 produces a 160 bit hash. The SHA-1 algorithm is featured in a large number of security protocols and applications. Recently Xiaoyun Wang managed to break the popular hashes, proving SHA-1 was not as secure as it was once considered.


SHA-2

SHA-2 is based closely upon the SHA-1 Algorithm. SHA-2 actually combines the SHA-224, SHA-256, SHA-384 and SHA-512 algorithms, some of which we will look at in more detail later. Federal agencies and other government authorities should start using the SHA-2 family of algorithms before 2010. People are still unsure about how secure SHA-2 actually is.


SHA-256

SHA-256 as we already mentioned is part of the SHA-2 family of products, it’s based on SHA-2 but with the capability for larger output strings (up to 256bits). The design of SHA-256 has changed a little, however because it is still based upon SHA-1 people are sceptical about just how sure it is.


SHA-384

SHA-384 is part of the SHA-2 family of algorithms, it is closely based upon SHA-1 but the output sizes are increased to 384 Bits.


SHA-512

SHA-512 is based upon SHA-1 algorithms, small differences do exist however. The string is increased in size to 512bits.


MD family of hashing algorithms

The MD family of hashing algorithms were designed by Ron Rivest during the late 1980’s and early 1990’s. MD actually stands for Message Digest, not Medical Doctor in this case!


MD2 hashes

MD2 was optimized to run on 8-bit computers and generates a 128-bit hash value the hashes are generally displayed as hexadecimal string which is 32 characters long. This hash exhibits features of the avalanche effect, and so even a very small change in the text string will result in a very different hexadecimal string being created.


MD5 Hashes

MD5 was developed in 1991 and it replaced the earlier hash function MD4 due to believed weaknesses in this algorithm. MD5 is still widely used for the protection of fairly insensitive information. 1996 was a very damaging year to MD5 however, a flaw was discovered in its design and so other hashing functions were suggested. The size of the hash is 128 bits, and so is small enough to allow a birthday attack.


HAVAL

HAVAL is another popular hash function, it differs from many other hash functions because it is possible for it to generate hash values in different lengths, the lengths of the hashes can be 128 bits, 160 bits, 192 bits, 224 bits or 245 bits. HAVAL was designed in 1992. This hashing function exhibits the avalanche effect and so even a small change in the string is likely to result in a very different hash value. Recent research, mostly by Xiaoyun Wang has indicated that HAVAL has a number of weaknesses, perhaps putting the use of it on hold.


RIPEMD-320

RIPEMD was developed by a European consortium, and was designed as an extension of the original RIPEMD hash function. The RIPEMD-320 function does not provide more security than RIPEMD-160, it simply provides the ability for longer hash strings. RIPEMD-320 is a double width string variant of the popular RIPEMD-160.


Gost

Gost was a set of Soviet Union standards and applied to everything from electronics to chemicals. Gost standardized everything in Russia meaning almost everything was interchangeable because it was compatible. Gost 28147-89 is the actual cipher which was designed by as a soviet and Russian standard. Gost 28147-89 is typically referred to as Gost in cryptology circles. Gost is based quite closely upon the US DES standard. The main concern with Gost is that the avalanche effect is not very quick to occur.


Whirlpool

Whirlpool is quite a young hash algorithm it was first released in 2000. Since then a few revisions have taken place. Whirlpool’s designers have promised never to patent Whirlpool instead it is free for anybody who wants to use it. Whirlpool hashes are usually shown as a 128 digit hexadecimal string. Whirlpool-0 is the first version, Whirlpool-1 the second and Whirlpool is the most recent release of the algorithm. Whirlpool is based on a modified version of the AES (Advanced Encryption Standard).


Which to choose?

Developers often want to develop applications that require the transmission of sensitive personal data and so some form of encryption is needed. Developers that use the .net framework can easily invest in .net hashing functions, hashing libraries are available at reasonable prices. It is possible to protect data using hashing algorithms if you purchase a hashing library. When deciding on which package to choose, be careful to look at that the number of times you can distribute the software Most .net hashing libraries are compatible with the whole .net suite, including Visual Basic, Visual C++ and Visual C#.


The most popular hashing algorithms are still the SHA family however because of the weaknesses identified it is only advisable to use the SHA-2 family of products. The US federal organizations must change to use SHA-2 before 2010.


SHA-1 is still considered secure for less sensitive purposes despite the flaws discovered in it. Business and homes are advised to use SHA-1 as it’s still more secure than MD5. Microsoft even relies upon the SHA-1 algorithm for the copy protection in it’s Xbox games console, so if it’s good enough for a company like Microsoft why not you? Microsoft tries to prevent people copying games at all costs.


Hashing algorithms can be reversed if you make enough calculations. The problem with hashing algorithms is that they quickly become outdated. To crack an algorithm it requires brute force trying all the different combinations. Computers get faster over time, and so they are able to complete more of these calculations in a shorter time. CPU speed generally increases at around 60% per year, but of course this will start to flatten out eventually. Even the latency of RAM decreases at around 10% per year, this means every year our computers get faster, and are capable of more calculations per second. A birthday attack is simply the length of time it takes to crack the code by brute force, it should be double the time it would be possible to do.


For a hashing algorithm to be considered secure it should have double the amount of calculations required to solve it in a feasible time. Computers are getting faster all of the time, and so more advanced hashing algorithms are being developed all the time.


Advanced encryption standard (AES) is the replacement for DES. There was a competition held to find a replacement for the aging DES technology, a team of two people Joan Daemen and Vincent Rijmen proposed the cipher Rijndael, which went on to win. This AES is the reason the NSA felt it necessary to launch the SHA-2 family of products.


The chart below indicates the hashes that are considered cracked. The current strongest encryption algorithms are SHA-512, RIPEMD-320, and Whirlpool. Any one of these algorithms are worthy of protecting top secret level information for your business.


Hash Number of bits Passes Cracked? Author Date launched
SHA-1 160 80 Yes NSA 1995
SHA-2 None* NSA 2000
SHA-256 256 64 None* NSA 2000
SHA-384 384 80 None* NSA 2000
SHA-512 512 80 None* NSA 2000
MD2 128 1 Yes** Ronald Rivest 1989
MD5 128 1 Yes Ronald Rivest 1991
HAVAL 128 No Yuliang Zheng, Josef Pieprzyk, Jennifer Seberry. 1992
RIPEMD-320 320 No Hans Dobbertin, Antoon Bosselaers, Bard Preneel. 1996
Gost 64 No Soviet union 1970’s
Whirlpool 512 No& Paulo Barreto, Vincent Rijmen 2001

 

*Although no attacks have been reported, people are sceptical of the security SHA-2 will provide because it is based closely upon the SHA-1 algorithm.


**MD2 can be defeated using a preimage attack with time complexity


+ Gost was developed and used from 1970 by the USSR, but because of the secretive nature the hash function was kept top secret until the USSR was dissolved and it was released to the public in 1994.


& No attacks have been reported on earlier versions of whirlpool, but new versions are currently being produced which are able to perform better and these are likely to be more secure.


 

Need to do hashing in .NET?
Perform hashing in .NET with the Kellerman Encryption Library


Author: Andrew H.
Date of article: 1/1/2007

This article is copyrighted © 2007 by Kellerman Software. All rights reserved. Permission is hereby granted to distribute this article in its entirety.