Can anyone, please, explain to me how to transform a phrase like “I want to buy some milk” into MD5? I read Wikipedia article on MD5, but the explanation given there is beyond my comprehension:
“MD5 processes a variable-length
message into a fixed-length output of
128 bits. The input message is broken
up into chunks of 512-bit blocks
(sixteen 32-bit little endian
integers)”
“sixteen 32-bit little endian integers” is already hard for me. I checked the Wiki article on little endians and didn’t understand a bit.
However, the examples of some phrases and their MD5 hashes in that Wiki article are very nice:
MD5(“The quick brown fox jumps over
the lazy dog”) =
9e107d9d372bb6826bd81d3542a419d6MD5(“The quick brown fox jumps over
the lazy dog.”) =
e4d909c290d0fb1ca068ffaddf22cbd0
Can anyone, please, explain to me how this MD5 algorithm works using some very simple example?
And also, perhaps you know some software or a code that would transform phrases into their MD5. If yes, please, let me know.
Forget about the endians: it’s just a way name for a way to encode information.
Let’s follow the wikipedia MD5 article. You start with an input message. It can be arbitrarily long: MD5 hashes for 2GB ISO files are routinely created, just like hashes for strings a dozen characters long (e.g. for passwords).
The hash will be contained in registers
a,b,candd. These registers are initialized with special values (h0-h3).The algorithm breaks the input into 16 4-byte chunks (“sixteen 32-bit little-endian words”) and applies specific logical operations (functions
F,G,HandI) on parts of the input and the current state of registersa,b,candd. It does this 64 times for each set of 16 4-byte chunks.When all of the chunks are processed, what remains in
a,b,canddis the final hash, the one you might get by invokingmd5sum testfile.txt.Update:
If you just want to be able to calculate a hash, implementing it yourself makes no sense because it’s been done and tested for probably every significant language out there:
Python:
SQL (MySQL):
Java:
etc.