MD5 (Message-Digest algorithm 5) is a 128-bit unidirectional “hash” algorithm. MD5 is a method by which it is possible to transform a word into an MD5 hash, but with an MD5 hash, it is never possible to find the word that originated it.
What does this mean?
MD5 is very useful when you want to archive passwords. For example, a password like "12345678" generates the MD5 hash "25d55ad283aa400af464c76d713c07ad" (always without quotes), but if someone discovers the MD5 hash, they will be unable (theoretically) to find the password that generated it.
Practical Use
A website administrator who values the authenticity of operations asks their user to create a password. They type it in, and when they go to save, the script will generate the MD5 hash, and only this will be archived. Thus, even if the administrator accesses their database and views the password, they will only see the MD5 hash. Then, when the user returns to the site and types in the password, the script will generate the MD5 hash as it did the first time and compare it with the archived one. If the generated MD5 Hash is the same as the archived one, access will be granted; if it is different, it will be denied.
Examples
Below are some characters "words", or passwords, and their MD5 hash
|
Character Text |
MD5 hash |
|
12345678 |
25d55ad283aa400af464c76d713c07ad |
|
silviolobo |
e8571a7f8d9d0e95b2448784e0b02396 |
|
Amor |
5da2297bad6924526e48e00dbfc3c27a |
|
Fé |
01e973a860fe82b0bae4c529c857348c |
|
a |
0cc175b9c0f1b6a831c399e269772661 |
MD5 with long characters, files, what changes?
MD5 can be used for signing programs or files. An example of a long MD5.
|
Our Father who art in Heaven, hallowed be Thy Name, Thy kingdom come, Thy will be done, on earth as it is in Heaven. Give us this day our daily bread; and forgive us our trespasses, as we forgive those who trespass against us, and lead us not into temptation, but deliver us from evil. Amen. |
|
MD5 hash: 99d155a830d49cab342b6e539156c6c1 |
I will remove the accent from “amém” and check how the MD5 hash looks
|
Our Father who art in Heaven, hallowed be Thy Name, Thy kingdom come, Thy will be done, on earth as it is in Heaven. Give us this day our daily bread; and forgive us our trespasses, as we forgive those who trespass against us, and lead us not into temptation, but deliver us from evil. Amem. |
|
MD5 hash: a0d86fea9f6c226fb357863616e82751 |
I kept the text identical, but in the first instance where the word “amém” was accented, the MD5 hash was “99d155a830d49cab342b6e539156c6c1”. In the second case, where “Amem” was used, the MD5 hash was “a0d86fea9f6c226fb357863616e82751”.
A single accent modifies the MD5 hash, making it ideal for verifying the integrity of files and documents. You will find various files on the internet, such as disk images (Linux, programs), which, along with the file, will include the MD5 to compare and ensure your downloaded file is intact.
Security! Is it possible to recover the "original" that generated the MD5?
Theoretically, no! But there are tools on the internet that act as Dictionaries. Each time a person types a word, it generates the MD5 hash and saves it in a database. Later, when someone searches for an MD5 hash, it looks in the database and displays the word that was registered in the past.
One example is http://md5.networkcore.eti.br/
If you have monstrous luck, you might find a password. However, don't waste your time trying to recover a file by correcting integrity issues.
Characteristics
The md5 hash is an alphanumeric string of 32 characters.
Easily used in PHP with the md5() function. Example: md5($string).
Crucial question: Is it possible for two MD5 hashes to be the same?
Yes, but it would be something extremely rare. Furthermore, this doesn't really become a problem given its intended purpose.
Notes: MD5 was developed by RSA Data Security. It is, broadly speaking, a complex calculation performed with each of the characters presented, whether from a password or a program's code or file; MD5 hash is what we call the result of this calculation.



