What Is SHA-256 Hashing and How Does It Work?

SHA-256 powers Bitcoin, SSL certificates, and Git. This explainer covers one-way functions, avalanche effect, collision resistance, and how to generate hashes right in your browser.

SHA-256 is everywhere. It secures Bitcoin transactions, authenticates HTTPS certificates, identifies every Git commit, and stores your passwords in databases. Yet most developers use it as a black box: input goes in, 64-character hex comes out. This article opens the box — and shows you how to generate hashes instantly with ToollyX.

What Is a Hash Function?

A cryptographic hash function takes arbitrary input (any length) and produces a fixed-length output (digest) with three critical properties:

🔁

One-Way

Given the hash, you cannot reconstruct the input. This is mathematically irreversible — not just computationally difficult, but fundamentally impossible to reverse.

🏔️

Collision Resistant

It's computationally infeasible to find two different inputs that produce the same hash. For SHA-256, no collision has ever been found.

🦋

Avalanche Effect

Changing a single bit in the input changes approximately 50% of the output bits. "hello" and "Hello" produce completely different 256-bit outputs.

SHA-256 Output: Always 64 Hex Characters

SHA-256 produces a 256-bit digest — always 32 bytes, always displayed as 64 hexadecimal characters. It doesn't matter if you hash a single letter or a 10GB file — output length is always identical.

SHA-256("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
SHA-256("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-256("Hello") = 185f8db32921bd46d35cc30b0a81a4f1b1e41b42a773e56c3f0f0c67e41e37f3

How SHA-256 Works (Simplified)

SHA-256 is a Merkle-Damgård construction:

  1. Padding: The message is padded so its length ≡ 448 mod 512, then the original length is appended as a 64-bit integer. Total becomes a multiple of 512 bits.
  2. Initial hash values (H0–H7): Eight 32-bit words initialised to specific constants derived from the fractional parts of square roots of the first 8 primes.
  3. 64 rounds per 512-bit block: Each round mixes the message schedule with bitwise operations (Ch, Maj, ΣSIGMA0, ΣSIGMA1, σsigma0, σsigma1) and 64 round constants (derived from cube roots of primes).
  4. Final digest: The eight working variables are concatenated as the 256-bit hash.

SHA-256 vs Other Hash Algorithms

AlgorithmOutputStatusUse Case
MD5128 bits / 32 hex❌ Broken (collisions found)Checksums only — never passwords
SHA-1160 bits / 40 hex⚠️ Deprecated (SHAttered 2017)Legacy systems only
SHA-256256 bits / 64 hex✅ Current standardTLS, Bitcoin, Git, document integrity
SHA-512512 bits / 128 hex✅ Current standardHigh-security applications, Unix shadow passwords
bcrypt60-char encoded✅ Password standardPassword storage only (slow by design)

Why SHA-256 Shouldn't Store Passwords Directly

SHA-256 is fast — a GPU can compute billions of SHA-256 hashes per second. That's exactly what makes it dangerous for password storage. An attacker who gets your SHA-256 password hashes can run GPU-accelerated dictionary attacks against them at massive speed.

For passwords, you need a slow, salted algorithm: bcrypt, scrypt, or Argon2. They're deliberately slow (milliseconds per hash instead of nanoseconds), making brute force impractical. Use the ToollyX bcrypt tool for password hashing. Use SHA-256 for data integrity, digital signatures, and checksums.

Real-World Uses of SHA-256

  • Bitcoin: Every block header is double-SHA256-hashed. Mining means finding a nonce that produces a hash below the target difficulty.
  • HTTPS certificates: TLS 1.3 uses SHA-256 for digital signatures in the handshake.
  • Git: Every commit, tree, and blob object is identified by its SHA-1 hash (SHA-256 support is in progress for Git's next format).
  • File integrity: Software downloads list SHA-256 checksums so you can verify the file wasn't tampered with.
  • HMAC: HMAC-SHA256 is used in AWS Signature V4, JWT HS256 signatures, and most API authentication schemes.

Using the ToollyX Hash Generator

The Hash Generator computes MD5, SHA-1, SHA-256, and SHA-512 simultaneously from a single input. MD5 uses a pure JavaScript implementation; SHA variants use the browser's native crypto.subtle.digest() — the same cryptographic primitive used by browser security systems. You can also drop a file to get its hash without uploading it anywhere.

#️⃣
Generate MD5, SHA-1, SHA-256, and SHA-512

Text or file input. Native WebCrypto API. No server involved.

Open Hash Generator →