MD5 vs SHA-256 — Hash Algorithm Comparison
Quick Answer: MD5 produces a 128-bit (32 hex character) hash and is fast but has known collision vulnerabilities. SHA-256 produces a 256-bit (64 hex character) hash with no known practical attacks. Use SHA-256 for any security purpose; MD5 only for non-security checksums like cache keys.
FAQ
Is MD5 broken?
For collision resistance, yes. Two different inputs can be crafted to produce the same MD5 hash. For preimage resistance (reversing a hash), MD5 is still computationally infeasible.
Is MD5 faster than SHA-256?
Yes, MD5 is roughly 2x faster than SHA-256. But both are extremely fast (GB/s on modern hardware), so the speed difference rarely matters in practice.