K052 / Hashes, MACs and key derivation
MD5
MD5 maps arbitrary-length input to a fixed 128-bit message digest.
CRYPTOGRAPHY LAB / K052
Cryptography Lab · MD5
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
MD5 (legacy)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- MD5 maps arbitrary-length input to a fixed 128-bit message digest. Source document ↗
- Classification and reversibility
- One-way hash, not encryption; a hash cannot be decrypted to recover the original. Source document ↗
- Key or secret requirements
- MD5 itself is keyless, but HMAC-MD5 uses a secret key. Source document ↗
- Operating principle and structure
- Pads and splits input into 512-bit blocks; compression, rotation and modular addition operate on a 128-bit state of four 32-bit words. Source document ↗
- Key size, block size and parameters
- 512-bit blocks, 32-bit words, 128-bit output, 64 rounds. Source document ↗
- Security strength and recommendation
- No longer secure; deprecated/not recommended for TLS 1.2/DTLS 1.2 signatures and other uses. Source document ↗
- Known attacks and vulnerabilities
- Actual collision exploitation has undermined certificate trust, e.g. forged intermediate CA certificates. Source document ↗
- Standards and certification
- Defined in RFC 1321; RFC 6151 and RFC 9155 address security and deprecation. Source document ↗
- Typical uses
- Historically used for integrity/authenticity checks, checksums and signature digests. Source document ↗
- Implementations, libraries and tools
- Libraries include crypto-es, Crypto++, rehashes and WjCryptLib. Source document ↗
- Decryption or decoding
- MD5 cannot be decrypted; so-called decrypt tools guess input candidates until their hashes match. Source document ↗
- Advantages
- Fast, simple and more reliable than basic checksums for legacy compatibility/non-security integrity checks. Source document ↗
- Limitations and cautions
- Not secure by modern standards; replace in security-sensitive uses with modern hashes. Source document ↗
- Distinguishing encryption, encoding and hashing
- Fixed-length one-way hash, not encryption or encoding; no key-based decryption or format decoding restores the original. Source document ↗
Practical examples
Example
Arbitrary input yields a 128-bit digest, usually displayed in hex. Compare file hash against expected value for integrity; use SHA-256/SHA-3 instead for security.
Procedure
Encryption/decryption is keyed and reversible; encoding/decoding is keyless reversible format conversion. MD5 is one-way and verified by rehashing identical input and comparing.
Scenario
Restrict required legacy MD5 checksums to non-security integrity. For security-critical files/packages use SHA-256 hashes and signatures; migrate stored MD5 by rehashing original input.
Pitfalls and alternatives
Do not mistake MD5 for reversible encryption. Use salted Argon2/bcrypt/scrypt/PBKDF2 for passwords, SHA-256/SHA-3/BLAKE2 for security integrity/signatures/TLS; avoid new MD5 except legacy compatibility.
References
- MD5 ↗
- TN209.fm ↗
- Paj's Home: Cryptography: JavaScript MD5: Instructions ↗
- Cryptographic Hash Functions: Design, Analysis & Applications ↗
- RFC 9155: Deprecating MD5 and SHA-1 Signature Hashes in TLS 1.2 and DTLS 1.2 ↗
- MD5 ↗
- RFC 1321: The MD5 Message-Digest Algorithm | RFC Editor ↗
- entronad/crypto-es ↗
- Python MD5 decrypt. ↗
- MD5 - Crypto++ Wiki ↗