MD5 (Message-Digest Algorithm 5), proposed by Ronald Rivest in 1991, maps data of any length to a 128-bit binary value, usually represented by 32 hexadecimal characters. It has an avalanche effect: even if only one bit of the original text is changed, the output will be completely different. MD5 was widely used for file integrity checks, digital signatures, and password storage. However, with increased computing power, MD5 collisions have been successfully constructed, making it unsuitable for high-security scenarios. It is still widely used for ordinary checks, deduplication, cache keys, and other low-security needs.
MD5 (Message-Digest Algorithm 5) is a widely used cryptographic hash function that generates a 128-bit (16-byte) hash value to ensure the integrity of information transmission. Main features:
1. Fixed length: No matter the length of the input data, the output of MD5 is always a fixed 128 bits (16 bytes).
2. Irreversible: The original data cannot be deduced from the MD5 output, making MD5 a one-way function.
3. High dispersion: Even if only one bit of the input data changes, the MD5 output will be completely different.
4. Collision resistance: The probability of two different data generating the same MD5 value is extremely low.
Common Uses:
- File integrity / checksum comparison
- Deduplication & cache keys
- Legacy systems expecting MD5
- Non-security fingerprinting of content
MD5 is intentionally fast; this makes brute force and rainbow table attacks practical on weak inputs. For passwords use bcrypt, scrypt, Argon2, or PBKDF2 with a unique salt and adequate cost factors. For collision resistance and digital signatures use modern hashes like SHA-256/512. Use MD5 only where accidental (not malicious) changes need detection and the risk profile is low.
Data padding: The input is padded so its length becomes N × 512 + 448 bits, then a 64‑bit field is appended to record the original length.
Initialization and rounds: Four 32‑bit state variables (A, B, C, D) are initialized and updated across multiple rounds to produce a 128‑bit MD5 digest.