What is MD5?

The MD5 is a one-way cryptographic function that used hashing algorithm to produce a 128-bit hash value. It accepts a message of any length as input and returns as output a fixed-length digest value to be used for authenticating the original message.

MD5 is used in many situations where a potentially long message needs to be processed and/or compared quickly. The most common application is the creation and verification of digital signatures.  It was designed by well-known cryptographer Ronald Rivest in 1991. 

Like most hash functions, MD5 is neither encryption nor encoding. It can be cracked by brute-force attack and suffers from extensive vulnerabilities.  It can still be used as a checksum to verify data integrity, but only against unintentional corruption.

The IETF suggests MD5 hashing can still be used for integrity protection, noting "Where the MD5 checksum is used inline with the protocol solely to protect against errors, an MD5 checksum is still an acceptable use." However, it added that "any application and protocol that employs MD5 for any purpose needs to clearly state the expected security services from their use of MD5".

How does it work? 

The MD5 algorithm first divides the input in blocks of 512 bits, broken down into 16 words composed of 32 bits each. The output from MD5 is a 128-bit message digest value.

MD5 digest in separate stages that process each 512-bit block of data along with the value computed in the preceding stage. The first stage begins with the message digest values initialized using consecutive hexadecimal numerical values. Each stage includes four message digest passes which manipulate values in the current data block and values processed from the previous block. The final value computed from the last block becomes the MD5 digest for that block.