A Chinese Cryptographer Broke MD5, MD4, and Two Other Hash Functions in One Day in 2004. Here Is What Happened Next.
In August 2004, a Chinese cryptographer named Xiaoyun Wang stood up at the Rump Session of CRYPTO 2004 in Santa Barbara and announced that she and her colleagues Dengguo Feng, Xuejia Lai, and Hongbo Yu had broken MD4, MD5, HAVAL-128, and RIPEMD, all in one paper. The room, which contained most of the world's prominent cryptographers, went quiet. MD5 had been the internet standard for file integrity verification since Ronald Rivest published it as RFC 1321 in April 1992. Wang had found collision attacks against all four functions in a matter of months. The original attack on MD5 required roughly 2^39 operations and could be completed in fifteen minutes to an hour on hardware typical of 2004.
A collision in a hash function means two different inputs that produce the same output. For a hash function to be cryptographically useful, finding a collision should be computationally infeasible. If two different files can produce the same hash, a malicious actor can substitute the legitimate file for a malicious one without changing the hash that would be used to verify it. Wang's result demonstrated that MD5 could no longer provide that guarantee.
The practical consequences arrived quickly. In 2007, researchers at CWI Amsterdam demonstrated a practical collision producing two different X.509 SSL certificates with the same MD5 hash. In December 2008, a team of researchers including Alexander Sotirov and Marc Stevens announced at the Chaos Communication Congress that they had used MD5 collisions to create a rogue SSL certificate authority that could be trusted by any browser. That attack required generating 200 MD5 collisions, which they accomplished in about two days on a PlayStation 3 cluster. The attack against HTTPS infrastructure, the foundational security protocol of the web, was real and working.
The Hash Function Lineage
Understanding how MD5 came to be the internet standard requires knowing the genealogy of cryptographic hash functions.
Ralph Merkle and Martin Hellman, co-inventors of public-key cryptography, described the requirements for secure hash functions in the late 1970s. Ron Rivest, the R in RSA, designed MD4 in 1990 and MD5 in 1992 as improvements over earlier work. MD stands for Message Digest, and the function was explicitly designed for computing message authentication codes and digital signatures.
SHA, the Secure Hash Algorithm, was developed by the National Security Agency and published by NIST in 1993. SHA-0 was revised to SHA-1 in 1995 after a flaw was found in the original. SHA-1 produces 160-bit digests and was widely adopted as the successor to MD5. In 2005, Wang's team also demonstrated attacks on SHA-1, showing that collisions were theoretically findable with far less computational effort than the 2^80 operations that a fully secure 160-bit function would require. Google's Project Zero and CWI Amsterdam produced the first practical SHA-1 collision, two different PDF files with the same SHA-1 hash, on February 23, 2017.
NIST published the SHA-2 family in 2001: SHA-256, SHA-384, and SHA-512. These functions have not been broken by collision attacks and remain NIST-recommended for security applications. In 2012, NIST selected Keccak as the SHA-3 standard after a five-year public competition specifically designed to produce a hash function with a different mathematical design from SHA-2, providing a hedge against future cryptanalysis.
What Hash Functions Actually Do
A cryptographic hash function takes an input of any length and produces a fixed-length output called a digest. The output length depends on the algorithm: MD5 produces 128 bits (displayed as 32 hexadecimal characters), SHA-1 produces 160 bits (40 hex characters), SHA-256 produces 256 bits (64 hex characters), SHA-512 produces 512 bits (128 hex characters).
The properties that make hash functions useful are:
Determinism: the same input always produces the same output. Hash functions are stateless and reproducible, which is what makes them useful for verification.
Preimage resistance: given a hash output, you cannot computationally find any input that produces it. This is the "one-way" property.
Avalanche effect: changing one bit in the input changes approximately half the bits in the output. This ensures that similar inputs produce completely different hashes.
Collision resistance: it should be computationally infeasible to find two different inputs that produce the same output. This is the property that Wang's attacks broke for MD5 and eventually SHA-1.
Fast computation: hash functions are designed to be computationally efficient so that verifying a file or computing a signature is fast. This speed property is both useful for verification and problematic for password storage, as discussed below.
Which Uses Are Now Safe and Which Are Not
The compromised collision resistance of MD5 matters for specific use cases and not others.
For digital signatures, certificates, and any use where an attacker might craft a malicious input matching a legitimate hash, MD5 is unusable and SHA-1 is deprecated. Major browsers stopped accepting SHA-1 certificates in 2017. NIST deprecated SHA-1 for digital signature applications in 2011 and disallowed its use entirely in federal information systems from 2014 onward.
For simple file integrity checksums where you are verifying that a file downloaded correctly and where the person providing the hash is trusted, MD5's collision weakness is less directly relevant. An attacker would need to create a malicious file that collides with the original file's MD5 hash, which is a more complex operation than simply finding a collision between two files they control. In practice, most infrastructure has moved to SHA-256 for all new use cases because the security margin is substantially higher and the cost of changing is minimal.
For forensic evidence hashing, MD5 and SHA-1 are still routinely used in practice, though SHA-256 has become the standard in more recent guidance. The digital forensics community uses hash values to verify that evidence files have not been altered, and the evidentiary integrity function is served by any hash function that is unlikely to produce collisions by accident. The weakness is against intentional crafted collisions, which differs from accidental collision.
Password Storage: A Different Problem
Password hashing is fundamentally different from file hashing, and using SHA-256 or any fast general-purpose hash for password storage is an error that creates serious security risk.
Fast hash functions process billions of inputs per second on modern hardware. An attacker who obtains a database of hashed passwords can attempt billions of password guesses per second against each hash, trying common passwords, dictionary words, and variations. With a fast hash like SHA-256, a comprehensive password guess effort against a leaked database is a matter of hours.
Password storage requires hash functions specifically designed to be slow. Bcrypt, published in 1999 by Niels Provos and David Mazieres, includes a work factor that can be increased as hardware improves, making brute-force attacks expensive. Scrypt, published in 2009 by Colin Percival, adds memory-hardness to make attacks on specialized hardware more difficult. Argon2, which won the Password Hashing Competition in 2015, combines time and memory hardness and is NIST's current recommendation for password hashing.
The distinction is not about the security of SHA-256 in general. SHA-256 is secure for its intended uses. Password hashing requires a different property, resistance to high-speed guessing, which general-purpose fast hashes are not designed to provide.
Verifying Files with Hash Values
The most common everyday use of hash functions is verifying file integrity. When you download large software, operating system images, or any file where corruption or tampering is a concern, the source typically publishes the SHA-256 hash alongside the download link. After downloading, you compute the hash of your local copy and compare it to the published value.
This operation is exactly what cryptographic hash functions were designed for. The comparison is a single equality check: the hash of your file either matches the published hash or it does not. A mismatch means either corruption during download or tampering. A match means byte-for-byte integrity relative to the file the source had when they computed the hash.
Conclusion
ToolHQ's hash generator computes MD5, SHA-1, SHA-256, and SHA-512 hashes for any text input. For file integrity verification, paste the file content or compare hashes of specific strings. For understanding how different hash functions compare, compute the same input with multiple algorithms to see how the digest length and format differ.
The story of hash function security is ongoing. SHA-2 has remained secure, but the existence of SHA-3 as a backup with a different mathematical foundation reflects that the cryptography community does not assume any single design is permanently safe. The lesson from Wang's 2004 announcement is that hash functions that were thought unbreakable were not. Planning security systems with that lesson in mind means preferring algorithms with larger security margins and being prepared to migrate when necessary.
Frequently Asked Questions
Is MD5 still safe to use?
For simple file integrity checksums where you trust the source of the hash, MD5 is still practical. For digital signatures, certificates, or any security-critical use, MD5 is broken and should be replaced with SHA-256 or SHA-512.
What is a hash collision?
A collision occurs when two different inputs produce the same hash output. Secure hash functions are designed to make collisions computationally infeasible to find. MD5 and SHA-1 no longer meet this standard.
Should I use SHA-256 or SHA-512?
Both are secure against known attacks. SHA-256 is more widely supported and sufficient for most uses. SHA-512 produces a longer output and may be faster on 64-bit processors due to its internal word size.
Can I use SHA-256 for password hashing?
No. SHA-256 is too fast for password hashing, allowing billions of guesses per second. Use bcrypt, scrypt, or Argon2, which are deliberately slow and designed for password storage.
Try These Free Tools
Base64 Encoder / Decoder
Encode and decode Base64 strings online. Also supports file to Base64 encoding for data URIs.
JWT Decoder
Decode and inspect JSON Web Tokens (JWT). View header, payload, and signature without verification.
Password Generator
Generate strong, random, and secure passwords instantly. Customize length and character types.