How Is the MD5 Hash Algorithm Calculated?

AI Thread Summary
The discussion centers on understanding the MD5 hash algorithm, specifically its calculation process as outlined in RFC 1321. Key points include the message padding method, which involves appending a '1' followed by zeros to reach a 512-bit boundary, and adding the original message length in the last 64 bits. The user seeks clarity on the function calculations, particularly the variable 's' used in the rotation operation, which is derived from specific constants in the algorithm. Additionally, there is curiosity about the representation of the buffer and whether reversing the register before calculation is standard practice. The conversation highlights the need for detailed guidance on these technical aspects of MD5 hashing.
mnms
Messages
2
Reaction score
0
Hi. I'm studying the cryptography MD5 calculation and have some trouble I'd like to seek help with. I am trying to comprehend the MD5 memo http://www.ietf.org/rfc/rfc1321.txt" and have trouble understanding the calculation.

Here is what I comprehend so far. A message is appended with a 1 followed by enough 0s to make it 64-bits shy of multiples of 512-bit. The last 64-bits appended being the length of the original message. I know that a four-word buffer, and four functions will be used, but I am not sure how and which bits to put in place.

I'm hoping someone would be able to explain the calculation of the functions and how the hash value is derived. I'm not sure if this is possible, but say given a word, to be able to produce a hash value through calculation. Thank you.
 
Last edited by a moderator:
Technology news on Phys.org
Hi, since I'm not getting any replies, I thought I might narrow down my question in hope for some answers or directions.

From ietf.org/rfc/rfc1321.txt,

Code:
The operation a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s)
I understand how to get most of the variables except s. The memo states the equation will rotate by s bit, but i do not know where is s derived from.

Code:
[ABCD  0  7  1]  [DABC  1 12  2]  [CDAB  2 17  3]  [BCDA  3 22  4]
[ABCD  4  7  5]  [DABC  5 12  6]  [CDAB  6 17  7]  [BCDA  7 22  8]
[ABCD  8  7  9]  [DABC  9 12 10]  [CDAB 10 17 11]  [BCDA 11 22 12]
[ABCD 12  7 13]  [DABC 13 12 14]  [CDAB 14 17 15]  [BCDA 15 22 16]
I also do not understand how are the numbers in these operation used. In relation to the previous question, one thing I do know is that s only uses the middle number of these operations, that is 7, 12, 17, 22.

Code:
word A: 01 23 45 67
word B: 89 ab cd ef
word C: fe dc ba 98
word D: 76 54 32 10
Another thing I'm also curious about, although not of much importance, is the representation of the buffer. Some sites reverses the register before calculation, for example word a will be 67 45 23 01. I would like to know if there is a reason behind this or just a preferred way of calculating.

I hope someone might be able to help me with these questions or point me a direction. Thank you.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top