MD5
An old 128-bit hash function that is completely broken for security and should only be used where no attacker is involved.
Attackers can craft two different files with the same MD5 digest, so it cannot prove that data is genuine.
In more detail
Collisions can be created in seconds, so MD5 must never protect passwords, signatures or downloads against tampering. Use SHA-256 instead.
Examples
MD5 still appears in old checksums; fine for spotting accidental corruption, useless against an attackerCollisions can be made for MD5 on purpose, so it cannot prove integrity against a determined attacker.Forensic records often list MD5 next to SHA-256 so older tools and databases can match; integrity rests on SHA-256.The course scanner flags hashlib.md5 used for a token fingerprint; use SHA-256 for fingerprints and a password hash for passwords.Related terms
- collision resistance — The property of a hash function that makes it infeasible to find any two different inputs that produce the same digest.
- SHA-256 — A widely used hash function that turns any data into a 256-bit fingerprint, shown as 64 hexadecimal characters.
- SHA-1 — An older hash function producing a 160-bit value, now considered broken for security because collisions can be created on purpose.
- checksum — A small value calculated from data and stored or sent with it, so the data can later be checked for accidental errors.
- hash — A short fixed-length fingerprint calculated from data, which changes completely if even one byte of the data changes.
- password hashing — Storing a password as the output of a deliberately slow, salted hash function, so a stolen database does not reveal the passwords.
- hash collision — Two different inputs that produce the same hash; a birthday attack finds such pairs far faster than guessing one at a time.
Taught in
- Cryptographic Hashing: SHA-256, SHA-3 & Passwords — Cybersecurity Fundamentals, GRC & Cryptography
- Reading Security Results: The Merge Request And The Vulnerability Report — GitLab Certified CI/CD Associate Exam Prep
- Cryptographic Primitives: node:crypto & Ciphers — Node.js Internals & Backend Services
- Forensics Principles, Custody & Imaging — Security Operations & Threat Hunting (SOC)
- Malware Triage: Hashes, Strings & Sandboxing — Security Operations & Threat Hunting (SOC)
- Static Application Security Testing — Application Security & Threat Modeling for Engineers
- How To Stop Drowning In Findings — Application Security & Threat Modeling for Engineers
- The Certificate That Expired On A Sunday: Hashes, Encryption And Certificates — CompTIA Linux+ (XK0-006) Exam Prep
References
- RFC 6151: Updated Security Considerations for MD5
- NIST glossary: MD5
- CWE-328: Use of Weak Hash
- RFC 1321: The MD5 Message-Digest Algorithm