MD5 & SHA-256 Hash Generator: How Cryptographic Hashing Works
Understand cryptographic hash functions — what MD5, SHA-1 and SHA-256 are, how they differ, and when to use each. Generate hashes online for free.
What is a Hash Function?
A cryptographic hash function takes an input of any length and produces a fixed-length output called a hash, digest, or checksum. The same input always produces the same output, but even a tiny change in the input produces a completely different hash — this is called the avalanche effect.
Critically, a hash function is one-way: it's computationally infeasible to reconstruct the input from the hash output.
Common Hash Algorithms
- MD5 — 128-bit (32 hex chars). Fast but cryptographically broken — collisions can be generated. Still used as a non-security checksum (file integrity verification).
- SHA-1 — 160-bit (40 hex chars). Also considered broken for security purposes since 2017. Avoid for new applications.
- SHA-256 — 256-bit (64 hex chars). Part of the SHA-2 family. Currently considered secure and widely recommended for security-sensitive applications.
- SHA-512 — 512-bit (128 hex chars). More secure than SHA-256; useful where maximum security is needed.
- bcrypt / Argon2 — Specifically designed for password hashing. Slow by design to resist brute-force attacks.
Key Properties of a Secure Hash
- Deterministic — same input always gives same output
- Pre-image resistance — cannot reverse the hash to find the input
- Collision resistance — extremely unlikely for two different inputs to produce the same hash
- Avalanche effect — changing one bit of input changes roughly half the output bits
Use Cases for Hashing
- Password storage — store password hashes, not plain text (use bcrypt or Argon2)
- File integrity verification — download a file and compare its SHA-256 to the published checksum
- Digital signatures — sign the hash of a document rather than the document itself
- Deduplication — identify duplicate files by comparing hashes
- Data integrity in Git — Git uses SHA-1 (migrating to SHA-256) to identify commits and objects
- Cryptocurrency — Bitcoin uses SHA-256 in its proof-of-work algorithm
MD5 vs SHA-256: Which Should You Use?
Use MD5 only for non-security purposes like quick file checksums or cache keys — never for passwords or security-sensitive data. Use SHA-256 for anything security-related. For password hashing specifically, use bcrypt or Argon2 — general-purpose hashes like SHA are too fast and unsuitable for password storage.
Using the ToolsPal Hash Generator
- Type or paste your input text
- All hashes (MD5, SHA-1, SHA-256, SHA-512) are computed simultaneously
- Click any hash to copy it instantly
Free Online Tool
Try Hash Generator
Generate MD5, SHA-1, SHA-256 and SHA-512 hashes.