Piyush Gupta et al, / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol.
5 (3) , 2014, 4492-4495
A Comparative Analysis of SHA and MD5
Algorithm
Piyush Gupta, Sandeep Kumar
Department of Computer Science and Engineering
Jagannath University, Jaipur
Abstract- This paper is based on the performance analysis of Secure Hash Algorithm works with that type of messages.
message digest 5 and secure hashing algorithm. These two Message digest is the output of SHA and length of these
topics are related with cryptography and cryptography is an type of messages is 160 bits (32 bits extra than MD5).
extension of cryptology and cryptanalysis. The purpose of this
paper is that to compare the time taken to build a hash as well
as it also compares the bit rate passes through a hash value.
II. MESSAGE DIGEST 5 ALGORITHM
Here we are going to perform a deep analysis for these two This algorithm is based on message length. It requires 8 bit
algorithms. of message length and too fast but also take long message.
// M= (Y0, Y1,………., Yn-1), Message to hash , after
Keywords Hash, MD5, SHA, Analysis , Cryptography, padding
Message, Cryptology .
// Each Yi is a 32-bit word and N is a multiple of 16
I. INTRODUCTION MD5 (M)
Hashing is the topic of cryptography .The //initialize (A,B,C,D) = IV
cryptography is a way of securing message and data over (A,B,C,D) = (0x67452301,0xefab89 , 0x98badcfe ,
the internet we know that, data is present on world wide Ox10325476 )
web is double day by day to secure these type of data we
are provide a fingerprint for its authenticity .Message For i=0 to N/16 -1
Digest is one way where a master fingerprint has been // Copy block I to X
generated for the purpose of providing a message Xj = Y16i+j for j = 0 to 15
authentication code (hash code) [4].
// Copy X to W
The Data integrity is measured by MD5 by the help of 128
bit message, that message is given by user to create a Wj = Xσ(j) , for j = 0 to 63
fingerprint message is of variable length, the main thing is // initialize Q
that it is irreversible. The Father of this algorithm is (Q-4 , Q-3 , Q-2 , Q-1) = (A , D , C , B)
Professor Ronald L. Rivest of MIT [1]. This algorithm is
// Rounds 0 , 1 , 2 and 3
best for 32 bit and 16 bit machines the comp-ability of this
algorithm can be extended to 64 bit machines also but this Round0(Q , W) Round1(Q , W) Round2(Q , W) Round3(Q
type of scheme may be quite slow because of its , W)
architecture. MD5 is the extension of MD4 algorithm // Each addition is modulo 232
which is quite faster because of its three rounds and MD5 (A , B , C , D)=(Q60 + Q-4 , Q63 + Q-1 , Q62 + Q-
contains four rounds which makes its slower. It’s a one way
1 , Q61 + Q-3)
hash function that deals with security features.
As a wide use of internet day by day it is needed that a next i
proper file has been download from peer to peer (P2P) return A , B , C , D
servers/network. Due to present of same name file it is end MD5
quite difficult to find the original so message digest plays
an important role in such type of downloads these type of Round0(Q , W)
file may be bound with message authentication code which //steps 0 through 15 for i = 0 to 15
proves that the source is verified otherwise it shows the Qi = Qi-1 + (( Qi-4 + F(Qi-1 , Qi-2 , Qi-3 ) + Wi
warning that verified source not found or vice versa . Both +Ki ) <<< si )
algorithms follows the same concept but with different
architecture [1] [5]. next i
The SHA Algorithm is a cryptography hash function and end Round() [1].
used in digital certificate as well as in data integrity. SHA is
a fingerprint that specifics the data and was developed by Step 1:- Padding bits and Append Length
N.I.S.T. as a U.S. Federal Information Processing Padding of the bits is compulsory with '0' and '1' first and
Standard (FIPS), is intended for use with digital signature last respectively until the resulting ≠ bit length which = 448
applications [3]. mod 512,and the last of bit length of the original message
The message which is less than 264 bits in length as 64-bit integer. The last bit length of the message which is
already padded is 512N for a true integer N.
[Link] 4492
Piyush Gupta et al, / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (3) , 2014, 4492-4495
Step 2:-Divide the input into 512-bit blocks III. SECURE HASHING ALGORITHM
The message which is already padded is now partitioned Step 1:-Padding
into N successive 512-bit blocks m1, m2...........mn. Add Padding to the end of the genuine message length is 64
bits and multiple of 512.
Step 3:- Initialize Channing variables Step2:- Appending length
Initialization of 32-bit number in the form of chaining In this step the excluding length is calculated
variables (A,B,C,D) these values are represented in hash Step3:- Divide the Input into 512-bit blocks
only In this step we divide the input in the 512 bit blocks
A = 01 17 2d 43 Step4:-Initialize chaining variables
B = 89 AB CD EF In this step we initializing chaining variables here we
C = FE DC BA 98 initialize 5 chaining variables of 32 bit each=160 bit of
D = 76 54 32 10 total.
Step5:-Process Blocks
Step 4:- Process blocks 1) Copy the chaining variables
The four buffers (A, B, C and D) messages (content) are 2) Divide the 512 into 16 sub blocks
joined now with the input words, using the four auxiliary 3) Process 4 rounds of 20 steps each [2].
functions (W, X, Y and Z).4 rounds are performed and each The fig 2 shows one SHA iteration.
involves 16 basic operations. The Processing block P is
applied to the four buffers (A, B, C and D), by using
message word M[i] and constant K[i]. The item "<<<s"
denotes a binary left shift by s bits. The four type of
IRF(info related functions) that each take as input three 32-
bit words and produce same bits of output i.e. 32-bit word.
They apply the logical operators ^, v, ! and xor to the input
bits.
Q (A, S, D) = AS v not (A) F
W (A, S, D) = AS v S not (F)
E (A, S, D) = A xor S xor F
R (A, S, D) = S xor (A v not (F))
The bits of A, S, and D are totalitarian and balance the
each bit of Q (A, S, D) will be totalitarian and balance.
The functions (A, S and D) = P, in that they do job in
"bitwise parallel" to produce the reliable output from the
bits of A, S and [Link] such a way that if the be similar bits [2].
of D, E and F are autarchic and balanced, then each bit of Fig 2:-One SHA iteration
W (A, S, D), E (A, S, D) and R (A, S, D) will be totalitarian
and balance. IV. PARAMETERS USED FOR MD5 AND SHA ALGORITHM:
A. Parameters of MD5.
Step 5:- Hashed Output Below equation shows a single MD5 operation.
There are 4 rounds performed in message digest 5 (MD5) 1)Default Parameters
which is of 128 bits. Fig 1 shows One MD5Operation [1] a = b + ((a + Process P (b, c, d) + M[i] + t[k]) <<< s) Here:-
[2]. a, b, c, d = are Chaining variables
Process P=A non linear operation
ith
M[i] =For M[q x 16 + i ], which is the 32-bit word in
qth
the 512-bit block of the message t[k]=a constant
<<<s =circular-left shift by s bits [2].
2) Actual Parameters.
Key Length: 64 bits, 128 bits, 256 bits , 512 bits
Block Size: 128 bits
Cryptanalysis: Resistance Strong against Digital
Certificate and very fast on 32 bit machines Security Secure
Rounds: 4
Steps: 16
B. Parameters of SHA.
Below equation shows a single SHA operation.
[2]. 1) Default Parameters.
Fig 1:-One MD5 iteration abcde(e+process p_s5(a)+W[t]+k[t]),a,s30(b), c, d
[Link] 4493