Featured image: A smartphone wrapped in a chain with a padlock. Photo by Towfiqu barbhuiya on Pexels (Free to use).
Few numbers in computing are more frequently seen and less frequently understood than the 64-character hex string at the end of a download page: the SHA-256 checksum. It is the fingerprint of a file, the engine of Bitcoin’s proof-of-work, the identifier of every Git commit, and the verification layer of countless webhook signatures. And it is also the answer people reach for when they should reach for something else entirely — hashing a password with SHA-256 is one of the most common security mistakes still made in new code.
This guide explains what SHA-256 actually does, how to tell hashing apart from encryption and encoding, where the algorithm is the right tool, and where it is the wrong one. To generate digests in your browser with no third-party code, use the free SHA Hash Generator on this site.
What a Hash Function Is
A cryptographic hash function is a one-way function with three defining properties:
- Deterministic. The same input always produces the same output — today, on this computer, and on any other computer.
- Fixed-size output. Whether the input is one character or a terabyte, SHA-256 returns exactly 256 bits (32 bytes, written as 64 hex characters).
- Avalanche effect. Change a single bit of the input and roughly half the output bits flip. There is no way to “work backwards” from output to input — the only attack is brute force.
Those properties make hashes ideal integrity fingerprints: you can verify that a file was not altered, without storing the file, by comparing a 64-character string.
The SHA Family: A Short History
SHA stands for Secure Hash Algorithm, published by the US National Institute of Standards and Technology (NIST). The relevant lineage:
| Algorithm | Digest size | Status in 2026 |
|---|---|---|
| MD5 | 128 bit | Broken — collisions are practical; never use |
| SHA-1 | 160 bit | Broken in practice (SHAttered, 2017); legacy only |
| SHA-256 | 256 bit | Standard — the default choice |
| SHA-512 | 512 bit | Standard — slower/smaller chips, faster on 64-bit CPUs |
| SHA-3 / BLAKE3 | variable | Modern alternatives; not yet ubiquitous |
The practical guidance collapses to one line: use SHA-256 unless you have a specific reason not to. It is fast, supported everywhere, and has no known practical collision attacks.
Hashing vs Encryption vs Encoding
The three are conflated constantly, and the differences decide which tool fits:
| Purpose | Key? | Reversible? | Example | |
|---|---|---|---|---|
| Encoding | Represent data in another format | No | Always | Base64, hex, UTF-8 |
| Encryption | Confidentiality | Yes | With the key | AES, ChaCha20 |
| Hashing | Integrity / fingerprint | No | Never (one-way) | SHA-256 |
The decision rule: data you need back → encryption. Data you only need to recognize → hashing. Data that must survive a text channel → encoding (see our Base64 guide). Most “which one do I use” confusion disappears once you ask: will anyone ever need to read the original again?
Where SHA-256 Is the Right Tool
File integrity. The classic use: a vendor publishes a checksum next to a download, and you verify the file after downloading. Any tampering — malicious or just a corrupted download — changes the digest.
Content fingerprinting. Git identifies commits and objects by SHA-1/SHA-256 digests of their contents. Blockchains chain blocks by hashing. Content-addressed systems derive IDs from content so identical content deduplicates for free.
Password verification — the wrong way and the right way. Storing SHA256(password) is wrong for two reasons: hashes are fast (an attacker can try billions of guesses per second on GPUs), and identical passwords produce identical hashes (leaking who reuses passwords). The fix is a slow, salted, memory-hard function: Argon2, bcrypt, or scrypt. Salt makes identical passwords hash differently; the deliberate slowness makes brute force expensive. SHA-256’s speed — a virtue everywhere else — is exactly its weakness here.
HMAC-SHA256 for signatures. HMAC wraps a hash function with a secret key: HMAC-SHA256(key, message). The result proves both integrity and that the sender knew the key. This is the standard for API request signing and webhook verification: Stripe, GitHub, and most LLM platforms sign webhook payloads this way. Whenever a system says “verify this signature,” you are almost certainly looking at HMAC.
How SHA-256 Works, in Broad Strokes
The full algorithm is beyond a blog post, but the shape matters because it explains the properties. SHA-256 processes input in 512-bit blocks through 64 rounds of a compression function. State starts as eight fixed 32-bit words; each block mixes the input into the state with bit rotation, addition, and XOR; the final state is the digest. Two consequences follow:
- Streaming. Because input is processed block by block, you can hash a file incrementally — which is why hashing a 10 GB file uses almost no memory.
- Irreversibility. Each round destroys information (the compression function is many-to-one), so no inverse exists. The only way to find an input matching a given digest is to guess.
What About Quantum Computers?
Quantum computers threaten asymmetric cryptography (RSA, ECC) via Shor’s algorithm. Symmetric hashes like SHA-256 are far less affected: Grover’s algorithm gives a quadratic speedup at best, meaning SHA-256 effectively halves to ~128 bits of security against a hypothetical quantum attacker — still comfortably safe. The practical quantum-era advice for hashing is the same as today’s: SHA-256 (or SHA-3) is fine; the asymmetric part of your stack is what needs migration planning.
A Practical Workflow
- Generate the digest of a file or message with the SHA Hash Generator (Web Crypto, no third-party code, nothing uploaded).
- Compare it against the published value — visually for one-offs, automatically in CI for repeatable verification.
- Store or transmit digests as hex (64 chars) or Base64 (44 chars) — the Base64 encoder handles the latter.
- Sign API requests with HMAC-SHA256, not with a bare hash.
And the one-line reminder worth taping to a monitor: passwords get Argon2/bcrypt; files get SHA-256; secrets get neither.
Generating and Verifying Checksums in Practice
The command-line tooling is universal, and the workflow is the same everywhere: generate, compare, automate.
Generate a digest of a file:
| Platform | Command |
|---|---|
| macOS / Linux | shasum -a 256 file.zip |
| Windows (PowerShell) | Get-FileHash file.zip -Algorithm SHA256 |
| Linux (alternate) | sha256sum file.zip |
| Browser / no CLI | the SHA Hash Generator |
Compare against the published value. For a one-off download, eyeballing works — but humans are bad at comparing 64 hex characters, which is how the classic “checksum mismatch” goes unnoticed. The robust pattern compares programmatically:
# macOS/Linux
echo "EXPECTED_HASH file.zip" | shasum -a 256 -c -
# the -c flag checks the file against the provided line and reports OK/FAILEDAutomate. In CI, verify every downloaded dependency against a pinned digest, and publish digests next to your own release artifacts (GitHub’s release pages show them automatically). Pinned-hash verification converts a supply-chain compromise from “undetectable” to “a red build” — the single highest-value integrity check a pipeline can add.
A worked example. Suppose a vendor publishes 9f86d081... for data.csv. You download, run shasum -a 256 data.csv, and get a different string. Two possibilities: the download corrupted (retry), or the file was tampered with or the vendor republished silently (stop, investigate). The hash cannot tell you which — it only tells you the bytes are not what was promised. That limitation is exactly the design: hashes detect, they do not adjudicate.
Choosing Algorithms for New Systems: The 2026 Checklist
When a new system needs a hash, run through this list once:
- Passwords → Argon2id (or bcrypt/scrypt). Never raw SHA-256.
- File integrity / fingerprints → SHA-256. Stable, fast, universal.
- High-assurance, long-term → SHA-512 or SHA-3-256, if you want margin against future advances.
- Message authentication → HMAC-SHA256 with a random 32-byte key — or an AEAD mode (AES-GCM, ChaCha20-Poly1305) when you are also encrypting.
- Deduplication / content addressing → SHA-256 over the content; add a length prefix to avoid ambiguity attacks.
Two questions that prevent most mistakes: is a secret involved? (yes → HMAC or AEAD, not a bare hash) and will anyone need the original back? (yes → encryption or encoding, not a hash).
Frequently Asked Questions
Algorithm family details per NIST FIPS 180-4 (SHA-2) and FIPS 202 (SHA-3). SHA-1 broken status per the SHAttered project (2017). Password guidance per OWASP Password Storage Cheat Sheet (Argon2/bcrypt/scrypt).
