2018_A comparative study of Message Digest 5(MD5) and SHA256 algorithm
2018_A comparative study of Message Digest 5(MD5) and SHA256 algorithm
*
Email: [email protected], [email protected], [email protected]
Abstract. The document is a collection of written or printed data containing information. The
more rapid advancement of technology, the integrity of a document should be kept. Because of
the nature of an open document means the document contents can be read and modified by many
parties so that the integrity of the information as a content of the document is not preserved. To
maintain the integrity of the data, it needs to create a mechanism which is called a digital
signature. A digital signature is a specific code which is generated from the function of producing
a digital signature. One of the algorithms that used to create the digital signature is a hash
function. There are many hash functions. Two of them are message digest 5 (MD5) and SHA256.
Those both algorithms certainly have its advantages and disadvantages of each. The purpose of
this research is to determine the algorithm which is better. The parameters which used to compare
that two algorithms are the running time and complexity. The research results obtained from the
complexity of the Algorithms MD5 and SHA256 is the same, i.e., Ɵ (N), but regarding the speed
is obtained that MD5 is better compared to SHA256.
1. Introduction
Cryptography is the science and art which aims to maintain the security of the message [9]. The primary
objectives of cryptography are authentication, integrity, and non-repudiation. The process of disguising
the substance of a message called encryption. The result of encryption process is a cipher text. While
the methods used to restore the cipher text to plain text is called decryption. There are three kinds of
cryptographic function: hash function, private key functions, and public key functions[4].
One way hashing is the topic of cryptography [2]. One way hash function is an algorithm which takes
a message of variable length as input and produces a fixed length string as output referred as hash code
or merely hash of the input message [1]. A robust one-way hash function is usually expected to satisfy
some requirements, namely collision resistance, preimage resistance, second preimage resistance[3].
There are a lot of hash function. Two of them are MD5 and SHA256.
The MD5 algorithm takes as input a message of arbitrary length and produces as output a 128-bit
message digest of the input. The authentication algorithm computes a digest of the entire data of the
secret message, used for authentication [6]. MD5 consists of 64 operations, grouped into four rounds of
16 operations [10]. The MD5 algorithm is designed to be quite fast on 32-bit machines. This algorithm
found by Professor Ronald L. Rivest[2].
The SHA256 algorithm is a cryptography hash function and used in digital certificate as well as in
data integrity. SHA256 is developed by N.I.S.T[5]. The SHA256 algorithm takes as input a message of
arbitrary length that smaller than 264 bits and produces as output a 256-bit message digest of the input[7].
Content from this work may be used under the terms of the Creative Commons Attribution 3.0 licence. Any further distribution
of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
Published under licence by IOP Publishing Ltd 1
2nd International Conference on Computing and Applied Informatics 2017 IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 978 (2018)
1234567890 ‘’“”012116 doi:10.1088/1742-6596/978/1/012116
2. Method
Step 6: Output
The message digest produced as output is A, B, C, D. That is, output begins with low-
order byte of A, and end with the high-order byte of D.
2
2nd International Conference on Computing and Applied Informatics 2017 IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 978 (2018)
1234567890 ‘’“”012116 doi:10.1088/1742-6596/978/1/012116
A 64-bit representation of the message's length is appended to the result. This step to
make the message length an exact multiple of 512 bits in length.
Where:
(256)
1 (𝑊𝑖−2 ) = ((𝑊𝑖−2 ) ROTR 17) ((𝑊𝑖−2 ) ROTR 19) ((𝑊𝑖−2 ) SHR 10)
(256)
0 (𝑊𝑖−15 ) =((𝑊𝑖−15 ) ROTR 7)((𝑊𝑖−15 ) ROTR 18) ((𝑊𝑖−15 ) SHR 3)
Step 6: Initialize the eight working variables, a, b, c, d, e, f, g, and h, with the(i-1)st hash value
For t=0 to 63:
{
T1 = h + ∑(256) 1 (𝑒)+Ch(e,f,g)+𝐾1
(256)
+ Wt
T2 = ∑(256) 0 (𝑎)+Maj(a,b,c)
H = G
G = F
F = E
E = d + T1
D = C
C = B
B = A
A = T1+ T2
}
Where:
∑(𝟐𝟓𝟔)
𝟏 (𝒆) = (e ROTR 6) (e ROTR 11) (e ROTR 25)
(𝟐𝟓𝟔)
∑𝟎 (𝒂) = (e ROTR 2) (e ROTR 13) (e ROTR 22)
Ch(e,f,g) = (e f) (e g)
Maj(a,b,c) = (a b) (a c) (b c)
Step 7 : Output
After repeating steps one through four a total of N times, the resulting hash function is
(𝑁) (𝑁) (𝑁) (𝑁) (𝑁) (𝑁) (𝑁) (𝑁)
𝐻0 || 𝐻1 || 𝐻2 || 𝐻3 || 𝐻4 ||𝐻5 ||𝐻6 ||𝐻7
3
2nd International Conference on Computing and Applied Informatics 2017 IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 978 (2018)
1234567890 ‘’“”012116 doi:10.1088/1742-6596/978/1/012116
4
2nd International Conference on Computing and Applied Informatics 2017 IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 978 (2018)
1234567890 ‘’“”012116 doi:10.1088/1742-6596/978/1/012116
3.3. Comparison of Running Time between MD5 Algorithm and SHA256 Algorithm
18
16
14 16,80931429
Running Time(ms)
12
10
8 10,25057143
6 8,198342857
4
2 4,7833
3,3644 3,674242857
0
Sample1.docx (11539 bytes) Sample2.doc (22528 bytes) Sample3.doc(47104 bytes)
4. Conclusions
In conclusion, we know that complexity of the MD5 algorithm and SHA256 is equal and the value is
Ɵ(N), but the running time of MD5 is faster than SHA256.
5. Acknowledgments
The authors gratefully acknowledge that the present research is supported by Fund Dissemination
IPTEKS Research Results for Lecturers / Researchers Universitas Sumatera Utara.
References
[1] Gauravaram, Praveen 2007 Cryptographic Hash Functions: Cryptanalysis Design and
Application. Ph.D. thesis, Information Security Institute, Faculty of Information Technology,
Queensland University of Technology.
[2] Gupta, Piyush, and Kumar, Sandeep 2014 A Comparative Analysis of SHA and MD5 Algorithm
International Journal of Computer Science and Information Technologies 5 (3) 4492-4495
[3] Handschub, H. and Gilbert, H. 2002 Evaluation Report Security Level of Cryptography – SHA-
256. Technical Report, Issy-les-Moulineaux.
[4] Hossain, M.A, Islam, M. K, Das S. K., and Nashiry, M. A. 2012 Cryptanalyzingof Message Digest
Algorithms MD4 and MD5 International Journal on Cryptography and Information
Security(IJCIS) 2(1) 1-13
5
2nd International Conference on Computing and Applied Informatics 2017 IOP Publishing
IOP Conf. Series: Journal of Physics: Conf. Series 978 (2018)
1234567890 ‘’“”012116 doi:10.1088/1742-6596/978/1/012116
[5] Kasgar, A.K, Agrawal, J., and Sahu, S. 2012. New Modified 256-bi MD5 Algorithm with SHA
Compression Function. International Journal of Computer Applications 42 (12) 47-51.
[6] Mishra, S, Mishra, S, and kumar, N. 2013. Hashing Algorithm: MD5. International Journal for
Scientific Research and Development 1 (9) 1931-1933.
[7] NIST 2002 Secure Hash Standard (SHS), FIPS PUB 180-2.
[8] Roshdy, R., Fouad, M., and Dahab, M. A. 2013 Design and Implementation A New Security Hash
Algorithm Based on MD5 And SHA-256. International Journal of Engineering Sciences &
Emerging Technologies 6 (1) 29-36.
[9] Schneir, Bruce 1996 Applied Cryptography 2nd ed Cryptography: Protocols, Algorithms, and
Source Code in C"; 1.1 MD5 15-20.
[10] Thomas, C.G, and Jose, R.T. 2015 A Comparative Study on Different Hashing Algorithms.
International Journal of Innovative Research in Computer and Communication Engineering 3(7)
170-175.