Hash Generator: What Are MD5, SHA-1, and SHA-256?
Understand cryptographic hash functions — what they do, the difference between MD5 and SHA-256, and practical uses.
What Is a Cryptographic Hash?
A cryptographic hash function takes input of any length and produces a fixed-length output (the hash or digest). The same input always produces the same output. Any change to the input — even one character — produces a completely different output. It is computationally infeasible to reverse the hash back to the input.
Hash functions are one-way — you can hash a document to get its fingerprint, but cannot un-hash the fingerprint to get the document.
Hash Algorithm Comparison
| Algorithm | Output Length | Status | Use Case |
|---|---|---|---|
| MD5 | 128 bits (32 hex chars) | Broken for security | Checksums, non-security |
| SHA-1 | 160 bits (40 hex chars) | Deprecated | Legacy systems |
| SHA-256 | 256 bits (64 hex chars) | Secure | Certificates, blockchain |
| SHA-512 | 512 bits (128 hex chars) | Very secure | High-security applications |
| bcrypt | Variable | Secure, slow | Password hashing |
Why MD5 Is No Longer Secure
MD5 was broken in 2004 — researchers demonstrated collision attacks (two different inputs producing the same hash). For security purposes, MD5 should not be used. For non-security uses (checksums, caching, deduplication), MD5 is still acceptable.
Practical Uses of Hash Functions
File integrity verification: Software providers publish SHA-256 hashes of download files. You hash the downloaded file and compare — if it matches, the file was not tampered with.
Password storage: Databases never store plain passwords. They store hashes. When you log in, your entered password is hashed and compared to the stored hash.
Digital signatures: Documents are hashed, and the hash is signed. Verifying the signature confirms the document has not been altered.
Blockchain: Each block contains the hash of the previous block. Changing any block would change its hash and break the chain.
Deduplication: Cloud storage services hash files to detect duplicates without reading content.
Frequently asked questions
What is the difference between MD5 and SHA-256?
MD5 produces a 128-bit hash and has known cryptographic vulnerabilities — do not use it for security. SHA-256 produces a 256-bit hash and is cryptographically secure and widely used for digital signatures, certificates, and blockchain.
Can you reverse a hash to get the original data?
No — hash functions are designed to be one-way. There is no mathematical way to reverse a hash to get the input. What is possible is a brute-force dictionary attack for weak inputs like common passwords.
Put this guide into practice with our free online tool — no signup required.
Open tool