Cryptographic hashes are one of the most useful and misunderstood tools in a developer's toolkit. Whether you're verifying a downloaded file, storing passwords, building checksums for caching, or signing API requests — hashing is involved. This guide explains how SHA-256 works and how to generate hashes instantly in your browser.
What is a cryptographic hash?
A hash function takes any input — a word, a file, an entire database — and produces a fixed-length output called a digest. It has three key properties:
- Deterministic — the same input always produces the same output.
- One-way — you cannot reconstruct the input from the hash.
- Avalanche effect — changing a single character completely changes the output.
helloandHelloproduce entirely different hashes.
This makes hashes perfect for integrity checking: if a file's hash matches what the publisher posted, the file hasn't been modified.
What is SHA-256?
SHA-256 (Secure Hash Algorithm 256-bit) is part of the SHA-2 family designed by NIST. It produces a 64-character hexadecimal digest and is the most widely used hash algorithm today:
- Used by Bitcoin for mining and transaction signing
- Used by TLS/SSL certificates for handshake integrity
- Used by package managers (npm, pip, apt) to verify downloads
- Used by Git (now moving to SHA-256) for commit and object IDs
- Used in HMAC for API request signing (AWS, Stripe, GitHub webhooks)
SHA-1 vs SHA-256 vs SHA-512 — which should you use?
| Algorithm | Output length | Status | Use case |
|---|---|---|---|
| SHA-1 | 40 hex chars | ⚠️ Deprecated | Legacy systems only — collision attacks exist |
| SHA-256 | 64 hex chars | ✅ Recommended | General purpose — file integrity, HMAC, certificates |
| SHA-384 | 96 hex chars | ✅ Secure | Higher security requirements, TLS 1.3 |
| SHA-512 | 128 hex chars | ✅ Secure | Maximum security, large file signing |
Default to SHA-256. SHA-512 is more secure but rarely necessary outside of specialized cryptographic applications.
Note: SHA hashes are not suitable for password storage. Use bcrypt, scrypt, or Argon2 for passwords — they're specifically designed to be slow and computationally expensive, which makes brute-force attacks impractical.
Common use cases for SHA-256 hashing
- File integrity verification — download a file, hash it, compare against the publisher's checksum
- API request signing — HMAC-SHA256 is used by AWS Signature V4, Stripe webhooks, GitHub webhooks
- Content addressing — Git, IPFS, and content delivery networks use hashes as unique content identifiers
- Deduplication — store the hash of each file to detect duplicates without reading the full content
- Cache invalidation — hash the content to build cache keys that automatically change when content changes
How to generate a SHA-256 hash using inspectly.dev
- Go to inspectly.dev/crypto and select the Hash tab
- To hash text: type or paste your content into the text area
- To hash a file: click Choose File and select any file from your device
- All four hashes (SHA-1, SHA-256, SHA-384, SHA-512) are computed simultaneously
- Click the copy icon next to any hash to copy it to your clipboard
All computation happens using the Web Crypto API built into your browser. Your text and files are never uploaded to any server.
Frequently asked questions
How do I verify a file's SHA-256 hash?
Download the file, then drag it into the Hash tab at inspectly.dev/crypto. Compare the SHA-256 output to the checksum published by the software author. If they match exactly, the file is authentic and unmodified.
Can two different files have the same SHA-256 hash?
In theory, yes — this is called a collision. In practice, no known SHA-256 collisions exist and finding one would require computational resources beyond anything currently available. SHA-256 is considered collision-resistant for all practical purposes.
Is SHA-256 the same as MD5?
No. MD5 is an older 128-bit hash algorithm with known collision vulnerabilities — do not use it for security purposes. SHA-256 is significantly stronger and is the current industry standard.
Why does the same file always produce the same hash?
Hash functions are deterministic — the algorithm always maps the same input to the same output, with no randomness involved. This is what makes them useful for verification: if the hash changes, the content changed.