MD5 Hash Generator
Generate MD5 hashes for text strings and data verification. MD5 produces a 128-bit (32 character hexadecimal) hash value. While no longer recommended for security purposes, MD5 remains widely used for checksums and data integrity verification.
Understanding MD5 Hashing
| Property | Value |
|---|---|
| Output length | 128 bits (16 bytes) |
| Hex representation | 32 characters |
| Speed | Very fast |
| Collision resistance | Broken (not secure) |
| Use case | Checksums, non-security |
MD5 Implementation
``javascript
// Using Web Crypto API (browser)
async function md5Hash(text) {
const encoder = new TextEncoder();
const data = encoder.encode(text);
// Note: Web Crypto doesn't support MD5
// Use a library like crypto-js
}
// Node.js
const crypto = require('crypto');
function md5(text) {
return crypto.createHash('md5').update(text).digest('hex');
}
// Example
md5('hello world');
// "5eb63bbbe01eeed093cb22bb8f5acdc3"
`
Common MD5 Use Cases
| Use Case | Example |
|---|---|
| File checksums | Verify downloads |
| Cache keys | md5(url + params) |
| Data deduplication | Compare file hashes |
| Legacy systems | Older password storage |
| ETags | HTTP caching |
Security Warning
MD5 has known vulnerabilities:
Collision attacks: Two different inputs can produce the same hash- Pre-image attacks: Possible to find input matching a hash
- Rainbow tables: Pre-computed hashes exist for common passwords
Never use MD5 for:
- Password hashing (use bcrypt, argon2)
- Digital signatures
- Certificate verification
- Any security-critical application
Verifying File Integrity
`bash
# Linux/Mac
md5sum filename.zip
# Windows
certutil -hashfile filename.zip MD5
``
Use MD5 for checksums and non-security applications only.