Design Of An Enhanced Cryptographic Hash Function ...

2 downloads 0 Views 409KB Size Report
Then also in everyday life people exchange data with one another. .... SHA-1 supports messages of any length less than 264 bits as input, and produces a ...
Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

1

Design Of An Enhanced Cryptographic Hash Function – Digest

Joseph Kobina Panford

Department of Computer Science, KNUST, Kumasi, Ghana

Length 512 Bits

James Ben Hayfron-Acquah

Department of Computer Science, KNUST, Kumasi, Ghana Kwabena Riverson

PhD, CSIR-Institute of Industrial Research, Accra, Ghana Justice Terper Nueteh

Department of Computer Science, KNUST, Kumasi, Ghana Aloysius Bampia Bangura

Department of Computer Science, KNUST, Kumasi, Ghana

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

2

ABSTRACT Privacy and data integrity continue to be major issues in Computer Science. Most people have email accounts and other accounts which they access with their usernames and passwords. Also in everyday life people exchange data with one another. Cryptographic Hash

Functions (CHFs) accept variable length of messages

and transform them into fixed length hash codes called digests. However researchers have uncovered serious security flaws and vulnerabilities in the most widely used CHFs such as Message Digests (MDs) and SHAs (Secure Hash Algorithms). This paper reviewed MD and SHA and proposed a new hash algorithm which is more collision resistant than MD and SHA. Keywords: Cryptography, Message Digest, Secure Hash Algorithm, Privacy, Data Integrity

1. INTRODUCTION 1.1 INTRODUCTION TO THE PROBLEM The main purpose of cryptographic hash functions is to ensure privacy and maintain the integrity of data sent across networks. Serious security flaws and vulnerabilities have been detected in the most widely used cryptographic hash functions such as Messags Digest (MD) and SHA (Secure Hash Algorithm) (Harshvardhan Tiwari, Krishna Asawa, 2012). In this paper a durable hash function that is fast, efficient, and secure is proposed. 1.2 BACKGROUND OF THE STUDY Privacy and data integrity continue to be major issues in Computer Science. Most people have email accounts which they access with their usernames and passwords. Not only emails but there other user accounts that are secured with passwords. Then also in everyday life people exchange data with one another. Cryptographic Hash Functions (CHFs) accept variable length of messages and transform them into fixed length hash codes called digests as shown in figure 1.

06d80eb0c50b49a509b49f

Administrator

Message

Hash function

Hash value (digest)

Figure 1: Depiction of how Cryptographic hash functions work CHFs are used to ensure privacy and to maintain the integrity of data transmitted across networks. Most software that have user accounts do not store the passwords in plain text. Rather they hash those passwords and store the digest (hashed value). For example if the word smarter is a password belonging to one of the users of a system, a hashed value of smarter ($675&895755RTY343) will be stored in the database instead of

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

3

the clear or plain text. Since these hashes are irreversible (one way) even if a hacker is able to get to where these hashed values of passwords are stored he cannot reverse them to get the original passwords. On the other hand if the user wants to log onto the system, the user provides the original password known only to him; the system hashes it and compares with what was stored in the database. If the two hashed values match then access to the system would be given, if not the system will deny the user access. In this way users can gain some level of privacy. Another area where CHFs are used is in message authentication. Before a message is sent, it is hashed. Both the message and the hashed value are sent. Upon receipt the message is hashed and the result compared with the hashed value sent along with the message. If they match then the message is authentic, if they do not then it means a hacker manipulated the message while being sent through a network. Finally CHFs can also be used in digital signatures. This has to do with digitally signing of documents. A message such as “I agree to pay $5000 for the software” will be hashed and the hash value encrypted with a private key. The resulting value is called a digital signature. At a later date the private key is used to decrypt the digital signature. If the decrypted value matches the hashed value of the message then the one who provided the private key is said to have digitally signed the document or message. There are three classical requirements or properties that CHFs must meet. They are 

Preimage resistance (one way)



Second Preimage resistance (Weak collision resistance)



Collision resistance (Strong collision resistance)

Preimage resistance ensures that when given a digest is should be computationally infeasible to come out with a message or messages that hash to the same digest. (Friedl, 2005). In other words it should be computationally impossible to come out with the Preimage X of H(X) when H(X) is given. This is illustrated in figure 2.

Figure 2: Preimage Resistance depicted (Friedl, 2005) Secondly, when given a message (m1) and its digest (d), it should be computationally infeasible to come out with another message (m2) that when hashed gives the same digest as the digest (d) given. That is it should be

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

4

impossible to come out with Y≠X with H(Y) = H(X), when X and H(X) are given. This is referred to as Second Preimage resistance or weak collision resistance, and is depicted in figure 3.

Figure 3: Second Preimage Resistance depicted (Friedl, 2005) Finally, Collision resistance, as illustrated in figure 4, ensures that it is computationally infeasible to come out with two different messages that when hashed will produce the same digest. That is , it is impossible to find X and Y with H(X) = H(Y).

Figure 4: Collision Resistance depicted (Friedl, 2005) Additionally CHFs should behave differently from random functions. When given the same input, they should come out with the same output. 1.3 STATEMENT OF THE PROBLEM Cryptographic hash functions are supposed to ensure privacy and maintain data integrity. However researchers have uncovered serious security flaws and vulnerabilities in the most widely used CHFs such as MD and SHA. 1.4 PURPOSE OF THE STUDY The aim is to come out with a durable cryptographic hash function that will overcome the security flaws and vulnerabilities in the existing ones. 1.5 OBJECTIVES OF THE STUDY The objectives of the research are as follows: 

To develop a new and durable cryptographic hash function.



To create the awareness of the most efficient cryptographic hash function needed for a particular situation.



To propose ways of curbing loopholes in the existing cryptographic hash functions.

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

5

2. LITERATURE REVIEW 2.1 INTRODUCTION The most popular CHFs in use today are variations of MD and SHA. MD4 was proposed by Rivest in 1990. Most commonly used hash functions are based on the design principles of MD4. SHA-0 was designed by developed by the National Security Agency as the secure hash standard in 1993. Then in 1995 SHA-1 was released. 2.2 MAIN POINTS Rivest came out with MD5 as a strengthened version of MD4 in 1992, because vulnerabilities in MD4 were exposed. Both MD4 and MD5 produce 128 bit message digest. MD5 is a little bit slower than MD4. Security flaws were also exposed in MD5. It was found out that MD5 was not durable when it comes to collision resistance. A number of slightly different messages yield the same result (digest) when hashed using MD5. An example is depicted in figure 5.

Figure 5: A real MD5 collision (Friedl, 2005) SHA-1 supports messages of any length less than 264 bits as input, and produces a 160-bit digest. It was an improvement over SHA-0. However SHA-1 is also susceptible to brute force attacks. Other variations such as SHA128 and SHA256 were later developed but they were also susceptible to brute force attach. In a brute force attack random inputs are tried, storing the results until a collision is found. To be able to overcome the security flaws in the variations of MD and SHA, a hash function that can produce a longer digest such as 512 bits is required. In this way a hacker has to perform 2 256 computations in order to find a collision. This is an impossible task because it will take months for the computation and chances are that there may be no collisions. In addition, the hash function should be able to satisfy all the three properties discussed earlier. This can be achieved if the hash function is designed in such a way that every input bit has a corresponding effect on the output bit (digest).

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

2.3 SUMMARY It is obvious that the most popular CHFs are susceptible to security attacks, defeating the very purpose for which they were invented. Therefore a durable CHF that will be secured needs to be designed. The secret lies in the length of the digest. The longer the digest the more difficult it is for attackers to be able to crack it. So the proposed CHF will take variable bit of message and produce 512 bit digest. It will also be carefully designed so that every input bit has a corresponding effect on the output bit.

3. METHODOLOGY 3.1 RESEARCH DESIGN Methodology refers to techniques that are used to construct research. Empirical research is based on observed and measured phenomena and derives knowledge from actual experience rather than from theory or belief (Wikipedia). The objective of carrying out this empirical research is to give a general discussion of the most common CHFs available and to develop a new and improved hash function. The need for this research has come about as a result of the fact that much research is not done on cryptographic hash functions based on recent study done. In this paper an experiment to determine the strength in term of security of the most common cryptographic hash functions will be carried out. To accomplish this, a test suite that will compare the various common hash functions against the three properties of hash functions will be developed. In the experiment, a full observation of the outcome and collection of data for further analysis were made. A hash function that was stronger in terms of security than the existing hash functions was developed. 3.2 DATA COLLECTION A number of data collection techniques exist, such as Sampling, Questionnaires, Simulation, Observatory, etc. Observation is the technique that was in collecting data in this research. Observation involves looking carefully. Two most common Cryptographic hash functions (MD5 and SHA 256) and the proposed hash function (JMD512) were used to hash 200 different messages. The number of these messages that failed the PreImage resistance, Second Pre-Image resistance, and the Collision resistance test for the various Cryptographic hash functions were observed and recorded. 3.3 INSTRUMENTATION As noted above, this research method is a quantitative one and by means of Empirical research strategy. Quantitative Research refers to research that places more emphasis on quantities and measurements. It deals with counts and measures of things and is about numbers and objective of data. A Test Suite developed in JAVA (NetBeans 8.1) and MySQL server was used to conduct this research on a computer system.

6

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

7

The source codes for MD5 and SHA256 were downloaded and added to the test suite that was developed. The test Suite also contains the proposed hash function (JMD512). 200 messages were then hashed using these hash functions. The output were recorded and analysed.

4. RESULTS 4.1 DEMOGRAPHIC BREAKDOWN Out of the 200 messages hashed by the 3 hash functions, between 20–30 failed the Pre-Image resistance test for SHA256, whiles between 30–40 failed the Pre-Image resistance test for MD5. Only between 0–5 messages failed the Pre-Image resistance test for JMD512. Also, between 30–40 messages failed the Second Pre-Image resistance test for SHA256, whiles between 40–50 failed the Second Pre-Image resistance test for MD5. Only between 0–7 messages failed the Second Pre-Image resistance test for JMD512. Finally, out of the 200 messages hashed by MD5, SHA256 and JMD512, between 10–20 failed the collision resistance test for SHA256, whiles between 20–30 failed the collision resistance test for MD5. Only between 0–5 messages failed the collision resistance test for JMD5. Table 1 and figure 6 depict a summary of the results. Table 1: Demographic breakdown of the weakness in terms of security for the CHFs CHFs MD5 SHA256 JMD512

Pre-Image 35 25 3

% 17.5 12.5 1.5

Second Pre- Image 45 35 4

% 22.5 17.5 2

50 45 40 35 30 25 20 15 10 5 0

Collision 25 15 3

MD5 SHA256 JMD512

Pre- Image

Second Preimage

Collision

Figure 6: Measuring the properties of CHFs

% 12.5 7.5 1.5

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

4.2 PRELIMINARY FINDINGS It could be observed from table 1 that an average of 35 messages failed the Pre-Image resistance test for MD5 making it the worst among the 3 CHFs. This is because the length of the output (digest) from MD5 is only 128bits. So is easier for a hacker to reverse the digest back to the original message. All the hacker has to do is to use a software to generate 2128 messages. One of those messages will be the original message that was hashed. SHA256 is better than MD5 with an average of only 25 messages failing the Pre-Image resistance test. This is because its digest length is 256 bits which is double that of MD5. JMD512 was the best with an average of only 3 messages failing the Pre-Image resistance test. This is because its digest length is 512 bits. It will take a hacker a very long period of time to generate 2512 messages. This makes it impractical for hackers to break hash values that are 512 bits long. The same can be said of the Second Preimage resistance and the collision resistance tests. Because JMD5 has a longer hash value (512bits) it is the best followed by SHA256 and then MD5. 4.3 INTERESTING FINDINGS Whiles the research was carried out, the Avalanche Effect, which is an emerging property of CHFs was noted. What this means is that every character in a message must have a significant effect on the hash value. For example if „can‟ and „cane‟ are hashed they should have totally different hash values. That is the „e‟ in the second message should have a significant effect on the hash value. To achieve this, the JMD512 was designed in such a way that every single character in a message was used in calculating the hash value. Achieving Avalanche effect in a CHF will make it collision resistant. That explains why, in table 2 and figure 6, JMD512 was the best in terms of collision resistance since only 3 messages failed the collision resistance test, whiles 25 messages and 15 messages failed the collision resistance test for MD5 and SHA256, respectively.

5. CONCLUSION In summary, for CHFs to be durable and strong in terms of security, they must successfully pass the PreImage, Second Preimage and Collision resistance tests. This can be achieved when the hash function is designed such that it produces a longer hash value. CHFs must also achieve the Avalanche effect which is an emerging property. Currently JMD512 produces the longest hash value (512bits) and achieves the Avalanche effect making it the best. Based on the properties assessed using tables and figures, the results clearly demonstrated that; JMD512 was the best when compared to MD5 and SHA256.

6. RECOMMENDATIONS Based on the main findings of this study, it is recommend that JMD512 be used in one-time passwords, message authentication, digital signatures and other areas of computer science that use CHFs. This is because

8

Researchjournali’s Journal of Computer Science Vol. 2 | No. 4 May | 2015 ISSN 2349-5391

it was the best when it comes to Pre-Image resistance, Second Preimage resistance, Collision resistance, and Avalanche effect. Current computing power and storage makes it impractical for hackers to generate 2 512 messages. This is because it will take a long period of time to be able to do this. However advances in technology reveal that in the next 5 decades computing power and storage will increase tremendously. I recommend that those who would like to research further on cryptographic hash functions in future should focus more on the length of hash values and also the avalanche effect of hash functions which is an emerging property of CHFs.

7. REFERENCES Harshvardhan Tiwari, Krishna Asawa. „A secure and efficient cryptographic hash function based on NewFORK-256‟. September, 2012. Steve Friedl. „An Illustrated Guide to Cryptographic Hashes‟ May, 2005. Erhan Kartaltepe. „Properties of Secure Hash Functions‟. January, 2015. John Edward Silva. „An Overview of Cryptographic Hash Functions and Their Uses‟. January, 2003 Rob Sobers. „THE DEFINITIVE GUIDE TO CRYPTOGRAPHIC HASH FUNCTIONS (PART I)‟. August, 2012

9