Docsity

Hashing Algorithms for Information Security, Slides of Information Security and Markup Languages

Partial preview of the text

Download Hashing Algorithms for Information Security and more Slides Information Security and Markup Languages in PDF only on Docsity!

Hashing Algorithms

MD5 Hashing Algorithm

MD5 Hashing Algorithm MDs Design MD5 (Message Digest Method 5) is a cryptographic hash algorithm used to generate a 128-bit digest from a string of any length. It represents the digests as 32 digit hexadecimal numbers. Ronald Rivest designed this algorithm in 1991 to provide the means for digital signature verification. The digest size is always 128 bits, and thanks to hashing function guidelines, a minor change in the input string generate a drastically different digest. This is essential to prevent similar hash generation as much as possible, also known as a hash collision. # Suppose we are given a message of 1000 bits. Now we have to add padding bits to the original message. Here we will add 472 padding bits to the original message. @ After adding the padding bits the size of the original message/output of the first step will be 1472 i.e. 64 bits less than an exact multiple of 512 (i.e. 512*3 = 1536). @ Length(original message + padding bits) = 512 * i — 64 where i = Pcie ce Cakes + Gee \ J | Total length to be 64 bits less than multiple of S12 Step 2.Append Length Bits: + In this step, we add the length bit in the output of the first step in such a way that the total number of the bits is the perfect multiple of 512. Simply, here we add the 64-bit as a length bit in the output of the first step. i.e. output of first step = 512 *n—64 length bits = 64. After adding both we will get 512 * n i.e. the exact multiple of 512. | Final Data to be Hashed as a multiple of 512 Step 4.Process Each 512-bit Block: @ This is the most important step of the MD5 algorithm. Here, a total of 64 operations are performed in 4 rounds. # Inthe 1st round, 16 operations will be performed, 2nd round 16 operations will be performed, 3rd round 16 operations will be performed, and in the 4th round, 16 operations will be performed. @ We apply a different function on each round i.e. for the 1st round we apply the F function, for the 2nd G function, 3rd for the H function, and 4th for the | function. We perform OR, AND, XOR, and NOT (basically these are logic gates) for calculating functions. We use 3 buffers for each function i.e. K, L, M. - F(K,L.M) = (K AND L) OR (NOT K AND M) - G(K,L,M) = (K AND L) OR (LAND NOT M) - H(K,L,M) =K XORL XORM - I(K,L,M) = L XOR (K OR NOT M) @ Now take input as initialize MD buffer i.e. J, K, L, M. Output of K will be fed in L, L will be fed into M, and M will be fed into J. After doing this now we perform some operations to find the output for J. + In the first step, Outputs of K, L, and M are taken and then the function F is applied to them. VVe will add modulo 232 bits for the output of this with J. + Inthe second step, we add the M[i] bit message with the output of the first step. + Then add 32 bits constant i.e. K[i] to the output of the second step. + At last, we do left shift operation by n (can be any value of n) and addition modulo by 232. @ After all steps, the result of J will be fed into K. Now same steps will be used for all functions G, H, and I. After performing all 64 operations we will get our message digest. Output: After all, rounds have been performed, the buffer J, K, L, and M contains the MD5 output starting with the lower bit J and ending with Higher bits M. Advantages of MD5 Algorithm x MDS5 is faster and simple to understand. x MDS5 algorithm generates a strong password in 16 bytes format. All developers like web developers etc use the MD5 algorithm to secure the password of users. x To integrate the MDS algorithm, relatively low memory is necessary. x It is very easy and faster to generate a digest message of the original message Disadvantages of MD5 Algorithm MD5 generates the same hash function for different inputs. MD5 provides poor security over SHA1. i MD5 has been considered an insecure algorithm. So now we are using SHA256 instead of MDS MD5 is neither a symmetric nor asymmetric algorithm noe Append padding bits Append Length Initialize hash bufffer SHA processing Output # Itis a6-step process of padding of '1000...’, # appending message length, # preparing 80 process functions, # preparing 80 constants, # preparing 5 word buffers, 4 processing input in 512 blocks. k 1.Appending Padding Bits. The original message is "padded" (extended) so that its length (in bits) is congruent to 448, modulo 512. The padding rules are: The original message is always padded with one bit "1" first. Then padded with as many 0’s as necessary to bring the message length to 64 bits fewer than a multiple of 512 .Preparing Processing Functions. SHAā€˜ requires 80 processing functions defined as: f(t;B,C,D) = (B AND C) OR ((NOT B) AND D) #tB,C,D XOR C XOR D f(t;B,C,D) = (BAND C) OR (BAND D) OR(CAND D) (40 <=t <= 59) f(t;B,C,D) = B XOR C XOR D (60 <= t <= 79) 1.Preparing Processing Constants. SHA1 requires 80 processing constant words defined as: K(t) = 54827999 (0 <=t <= 19) ( K(t) = GED9EBA1 K(t) = 8F1BBCDC K(t) = CA62C1D6