a cryptographic hash function with a 128-bit (16-byte) output, now deprecated

MD5 is a cryptographic hash function. It was the de facto standard cryptographic hash in the 1990s but is now deprecated because vulnerabilities have been discovered.

An MD5 checksum consists of 128 bits (16 bytes) which are often presented as 32 hexadecimal digits.

MD5's collision resistance is broken: it is possible to find two strings with the same MD5 checksum (there can be some additional requirements on the strings, for example a common prefix). For applications that only rely on other properties such as preimage resistance (the impossibility of finding a string given its MD5 checksum, except by brute force), the attacks are only theoretical.

Applications that require a cryptographic hash should use SHA-2 instead. SHA-2 produces a 256-bit (32-byte) checksum (there are other, less common sizes), not 128-bit, so applications with a fixed-size field must be updated. SHA-1 is also a viable alternative; although SHA-2 is meant to replace SHA-1, there are currently no practical vulnerabilities in SHA-1 that SHA-2 solves.

Neither MD5 nor SHA-1 or SHA-2 are suitable for password hashing. Use PBKDF2, bcrypt or scrypt. Read How to securely hash passwords? for more information.

history | excerpt history