Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from text.
Hash Algorithm Comparison
| Algorithm | Output Size | Security | Use Case |
|---|---|---|---|
| MD5 | 128 bits | Broken | Checksums only |
| SHA-1 | 160 bits | Weak | Legacy systems |
| SHA-256 | 256 bits | Strong | General purpose |
| SHA-512 | 512 bits | Strong | High security |
Code Examples
// Using Web Crypto API (SHA-256)
async function sha256(text) {
const encoder = new TextEncoder();
const data = encoder.encode(text);
const hash = await crypto.subtle.digest('SHA-256', data);
return Array.from(new Uint8Array(hash))
.map(b => b.toString(16).padStart(2, '0')).join('');
}Frequently Asked Questions
Which hash algorithm should I use?
For security: use SHA-256 or SHA-512. SHA-1 and MD5 are cryptographically broken. For checksums (non-security): MD5 is fast and widely supported.
Can hashes be reversed?
Hashes are one-way functions and cannot be reversed. However, common values can be looked up in rainbow tables. Always use salted hashes for passwords.
Why do different tools give different hashes for the same input?
Check encoding (UTF-8 vs ASCII), line endings (LF vs CRLF), and whether there's a trailing newline. These differences change the hash completely.