Hash Generator - MD5, SHA-1, SHA-256, SHA-512

Generate cryptographic hash digests from any text input. Compare MD5, SHA-1, SHA-256, and SHA-512 outputs side by side. All hashing runs in your browser — no data leaves your machine.

What Is a Cryptographic Hash?

A cryptographic hash function takes an input of any length and produces a fixed-length output called a hash or digest. The same input always produces the same output, but even a single character change produces a completely different hash — the avalanche effect. Hash functions are one-way: you cannot reverse a hash to recover the original input.

Hash Algorithm Comparison

AlgorithmOutput SizeSpeedSecurity StatusCommon Uses
MD5128-bit (32 hex chars)Very fastBroken — not for securityNon-security checksums, legacy systems
SHA-1160-bit (40 hex chars)FastDeprecatedGit commit IDs (legacy), checksums
SHA-256256-bit (64 hex chars)FastSecureFile integrity, TLS certificates, Bitcoin
SHA-384384-bit (96 hex chars)ModerateSecureTLS, high-security signatures
SHA-512512-bit (128 hex chars)ModerateSecureHigh-security checksums, HMAC

Practical Use Cases

Generating Hashes in Code

Node.js

import { createHash } from 'crypto';

const hash = createHash('sha256')
  .update('hello world')
  .digest('hex');
// b94d27b9934d3e08a52e52d7da7dabfac484efe...

Python

import hashlib

text = "hello world"
sha256 = hashlib.sha256(text.encode()).hexdigest()
md5 = hashlib.md5(text.encode()).hexdigest()

Shell (Linux/macOS)

# SHA-256 of a file
sha256sum filename.zip

# MD5 of a string
echo -n "hello world" | md5sum

Security Best Practices

Frequently Asked Questions

What is the difference between MD5, SHA-1, and SHA-256?

MD5 produces a 128-bit hash and is cryptographically broken. SHA-1 produces 160 bits and is deprecated for security use. SHA-256 produces 256 bits and remains secure. Choose SHA-256 or SHA-512 for any new security-sensitive work.

Can I reverse a hash back to the original text?

No. Hash functions are one-way by design. Attackers use precomputed rainbow tables to look up common passwords from their MD5/SHA-1 hashes. This is why salted password hashing with bcrypt or Argon2 is critical for storing user passwords.

Which hash algorithm should I use?

For file integrity: SHA-256 or SHA-512. For password storage: bcrypt, scrypt, or Argon2 (not raw SHA). For HMAC authentication: SHA-256. For non-security checksums: MD5 is fine. Avoid MD5 and SHA-1 for anything security-related.

Why do some file downloads provide multiple hash types?

Publishers often provide MD5, SHA-1, and SHA-256 checksums to support users with different tools. MD5 is included for legacy compatibility; SHA-256 is the one you should actually verify. If any hash matches, the file is intact.

Related Hash & Data Tools