Every time a browser shows a padlock icon, a password gets checked at login, or a Bitcoin transaction gets confirmed, a hashing algorithm has already done its job in the background, silently and almost instantly. Most people never think about it until something breaks: a certificate warning, a leaked password database, a “file corrupted” message on a download that should have worked fine.
That’s usually when someone searches “what is a hashing algorithm” and lands on an explanation that defines the term, lists five algorithm names, and stops. This guide goes further. It covers the property that actually failed when SHA-1 collapsed in 2017, what hashing looks like inside your own SSL certificate right now, the algorithm NIST finalized in 2024 to survive quantum computers, and the mistakes that still show up in production code today.
What is a hashing algorithm? A hashing algorithm is a mathematical function that converts data of any size into a fixed-length output called a digest. The same input always produces the same digest, a single-character change produces a completely different one, and reversing a digest back into its original input is computationally infeasible.
Why Hashing Still Matters in 2026
Hashing has become more load-bearing, not less, as the systems around it have changed. Zero Trust security models assume no device or user is trustworthy by default, which means every request needs continuous cryptographic verification instead of a one-time login check, and hashing is what makes that verification cheap enough to run constantly at scale.
Passwordless authentication, passkeys built on WebAuthn and FIDO2, replaces the password itself with public-key cryptography, but the credential IDs and attestation data involved are still hashed for storage and comparison at the server. Software supply chain security has become its own discipline following a string of high-profile compromises, and every serious response to it depends on hashing every artifact at every build stage so a tampered dependency can’t slip through unnoticed:
- Software Bill of Materials (SBOM) verification hashes every declared component against its expected value.
- Signed container images use a hash of the image layers as the basis for the signature itself.
- Package managers like npm and pip verify published packages against a recorded hash before installation.
None of this is new cryptography. What changed is how many systems now depend on it running correctly by default rather than as an optional hardening step.
Hashing vs Encryption vs Encoding vs Digital Signatures
These four get used interchangeably in casual writing, and the confusion causes real mistakes. Encoding, Base64 for example, reformats data for compatibility and provides zero security, since anyone can reverse it instantly with no key at all. Encryption transforms data so only someone holding the correct key can reverse it, a two-way process built for confidentiality. Hashing transforms data into a fixed-length digest that cannot practically be reversed, a one-way process built for integrity and verification, not secrecy. A digital signature combines both: the data is hashed first, then that hash is encrypted with a private key, which is why a signature proves both that data hasn’t changed and who created it.
| Concept | Reversible? | Purpose | Needs a key? |
|---|---|---|---|
| Encoding | Yes, trivially | Compatibility, not security | No |
| Encryption | Yes, with the key | Confidentiality | Yes |
| Hashing | No | Integrity, verification | No |
| Digital signature | Partially (signature only) | Integrity plus authorship | Yes, asymmetric pair |
The most common real-world mistake here is storing a password with reversible encryption instead of a one-way hash. Anyone who later obtains that encryption key, an administrator, an attacker, or a subpoenaed vendor, can recover every plaintext password at once. A properly hashed password database gives an attacker nothing to decrypt at all, which is exactly the property you want when the database itself gets stolen.
How a Cryptographic Hash Function Actually Works
A hash function processes input in fixed-size blocks, since its internal compression function can only operate on a set amount of data at a time. If the final block falls short, padding, typically a bit pattern marking where the real message ends plus the original message length, fills it out to the required size. An initialization vector, a fixed starting value defined by the algorithm’s specification, seeds the very first compression round, since the process needs some starting state before any real data has been processed.
Each block then runs through repeated compression rounds, where the output of one round feeds into the next along with the next block of data, a design called the Merkle-Damgard construction, used by both SHA-1 and SHA-2. SHA-3 works differently, using a sponge construction that absorbs input data in stages and then squeezes out the digest, a structural choice made specifically so a future flaw in SHA-2’s design wouldn’t compromise SHA-3 as well.
The avalanche effect is what makes the whole system trustworthy rather than just mechanically consistent. A single flipped bit in the input should change roughly half the bits in the output, with no visible pattern connecting the two. Without this property, an attacker could nudge guesses closer to a target hash incrementally, the same way you’d solve a “getting warmer” puzzle. With it, “hello” and “Hello” produce digests that share no visible structure at all, despite differing by one capitalized letter, which is exactly what the worked example in the next section demonstrates.
Characteristics That Make a Hash Algorithm Secure
Six properties, together, define whether a hash function is actually secure rather than merely functional:
- Deterministic — the same input always produces the same output, every time, on every machine.
- One-way — computing the digest from the input is fast; computing the input from the digest is infeasible.
- Preimage resistance — given a digest, nobody can find any input that produces it.
- Second preimage resistance — given one specific input and its digest, nobody can find a different input producing the same digest.
- Collision resistance — nobody can find any two inputs, chosen freely, that produce the same digest.
- Uniform distribution — outputs spread evenly across the possible output space, with no values or patterns occurring more often than chance would predict.
Collision resistance is the weakest of the three resistance properties, and it’s almost always the first to fail as an algorithm ages. SHA-1 lost its collision resistance years before anyone could threaten its preimage resistance, which is exactly why it kept working for some purposes long after security researchers had stopped trusting it for others. Confusing these properties, treating “broken” as one single on/off state rather than three independently failing properties, is why so many “is X algorithm safe” questions get answered incorrectly online.
Anatomy of a Hash Digest
A digest can be represented in several formats, and they’re the same underlying bits displayed differently, not different values. Binary is the raw form the algorithm actually produces. Hexadecimal, the most common display format, represents each 4 bits as one character, so a 256-bit SHA-256 digest displays as exactly 64 hex characters. Base64 packs the same bits more compactly, using 6 bits per character instead of 4, which is why Base64-encoded digests look shorter even though they represent identical data.
Here’s a real, verifiable example. Run the five-character string “hello” through SHA-256, and you get exactly this digest, every time, on every machine:
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 hello
Capitalize one letter, and the output shares nothing visible with the original:
185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969 Hello
You can verify this yourself in about ten seconds by running echo -n "hello" | shasum -a 256 on any Mac or Linux terminal. Digest length maps directly to security level under the birthday bound: a 256-bit digest offers roughly 128 bits of collision resistance, since collision attacks scale with the square root of the total output space rather than the full space itself, which is why doubling a digest’s bit length roughly squares an attacker’s required effort instead of merely doubling it.
A Complete Evolution Timeline of Hash Algorithms
Hash algorithms haven’t evolved randomly. Each new generation responded to a specific, documented weakness discovered in the one before it:
- MD2 (1989) — designed for 8-bit systems, now considered cryptographically broken and obsolete.
- MD4 (1990) — faster than MD2, but full collisions were demonstrated within a few years of publication.
- MD5 (1992) — the internet’s default checksum algorithm for over a decade, until practical collisions were demonstrated in 2004.
- SHA-0 (1993) — withdrawn by the NSA shortly after publication over an undisclosed flaw, later understood to be a weakness in its message expansion.
- SHA-1 (1995) — served as the primary signing hash for TLS and Git for two decades, until the SHAttered collision attack in 2017.
- SHA-2 (2001) — the family including SHA-256 and SHA-512, still the current baseline standard for TLS certificate signatures today.
- SHA-3 (2015) — standardized by NIST, built on the structurally distinct Keccak design, specifically as insurance against a future SHA-2 flaw.
- BLAKE (2008) — a SHA-3 competition finalist, never standardized itself but the direct ancestor of what came next.
- BLAKE2 (2012) — faster than MD5 while remaining as secure as SHA-3, widely adopted in checksums and some cryptocurrencies.
- BLAKE3 (2020) — parallelizable across CPU cores, currently the fastest widely available cryptographically secure hash for large files.
Popular Hashing Algorithms Compared
| Algorithm | Digest size | Status today | Where it’s still used |
|---|---|---|---|
| MD5 | 128-bit | Broken for security | Non-cryptographic checksums only |
| SHA-1 | 160-bit | Broken, banned in TLS | Legacy Git commit IDs |
| SHA-224 | 224-bit | Secure, less common | Space-constrained certificate use cases |
| SHA-256 | 256-bit | Current standard | TLS certificates, code signing, Bitcoin |
| SHA-384 | 384-bit | Secure, higher margin | High-security TLS configurations |
| SHA-512 | 512-bit | Secure, faster on 64-bit CPUs | High-security environments |
| SHA3-256 | 256-bit | Standardized alternative | Protocols wanting structural diversity from SHA-2 |
| SHA3-512 | 512-bit | Standardized alternative | Same, at a higher security margin |
| BLAKE2 | Up to 512-bit | Fast, secure | Checksums, some cryptocurrencies |
| BLAKE3 | 256-bit (extendable) | Fast modern option | Large file integrity, package managers |
| RIPEMD-160 | 160-bit | Secure, niche | Bitcoin address generation (alongside SHA-256) |
| Whirlpool | 512-bit | Secure, rarely used | Some archival and forensic tools |
Why MD5 and SHA-1 Are No Longer Trusted
Vague warnings that “MD5 and SHA-1 are broken” rarely explain what broke, or when. Researchers Xiaoyun Wang and colleagues demonstrated a practical MD5 collision in 2004. By December 2008, a team led by Alexander Sotirov used a chosen-prefix MD5 collision to forge a rogue certificate authority certificate, one that browsers of that era would have trusted completely, presented publicly at the Chaos Communication Congress.
SHA-1’s collapse came later and more publicly. On February 23, 2017, a joint team from Google and the CWI Amsterdam research institute published SHAttered, the first practical collision attack against full SHA-1, producing two visibly different PDF files that hashed to an identical SHA-1 digest. The attack required an estimated 9.2 quintillion SHA-1 computations, an enormous but no longer impossible amount of compute for a well-resourced attacker. Chrome and Firefox had already begun rejecting SHA-1 certificate signatures earlier that year, and the CA/Browser Forum’s baseline requirements, the rules every publicly trusted certificate authority must follow, have barred SHA-1 signing on new certificates ever since. Both cases teach the same lesson: collision resistance fails gradually, through improving attacks, long before anyone declares an algorithm dead by decree.
SHA-2 vs SHA-3: Which Should You Choose?
SHA-2 and SHA-3 solve the same problem through genuinely different internal designs, and the choice between them is less about strength today and more about long-term insurance. SHA-2 uses the Merkle-Damgard construction described earlier, while SHA-3 is built on Keccak’s sponge construction, absorbing input and squeezing out a digest through a fundamentally different internal permutation.
For nearly all current work, SHA-256 remains the right default. It has over two decades of cryptanalysis behind it, hardware acceleration built into most modern CPUs, and it’s the algorithm every public certificate authority already uses to sign certificates. SHA-3 isn’t faster in most software implementations, and no certificate or code-signing standard requires it today. Adoption trends reflect this: SHA-3 shows up in newer protocols and compliance frameworks that specifically want structural diversity from SHA-2, not as a general replacement. Treat SHA-3 as a backup plan built in advance, not an upgrade you need to make right now.
BLAKE3: The Fastest Modern Hash Algorithm?
BLAKE3, released in 2020, is built for raw throughput rather than novelty. Its internal tree structure allows different parts of a large file to be hashed in parallel across multiple CPU cores simultaneously, something SHA-256’s sequential block-chaining design cannot do at all. In practice, this makes BLAKE3 the fastest widely available cryptographically secure hash for large files, which is exactly why it’s found real adoption in specific workloads:
- Cloud storage providers use it for high-throughput deduplication across massive datasets.
- Backup software uses it to verify large archives quickly without becoming the bottleneck in the backup process itself.
- Some package managers and software distribution tools have adopted it for faster integrity verification on large downloads.
It hasn’t been standardized by NIST, and no public certificate authority accepts it for signing, so it currently belongs in file-integrity and internal tooling contexts rather than anywhere a public trust chain is involved.
Hashing in SSL/TLS Certificates
Most hashing explainers never connect the concept to the certificate sitting on your own server, even though certificates depend on hashing in several distinct places that are easy to confuse with each other.
The signature hash is what the certificate authority actually signs. When a CA issues your certificate, it hashes the certificate’s contents, then encrypts that hash with its own private key. Every browser that connects to your site re-hashes the certificate independently and checks that the decrypted signature matches, and every publicly trusted CA has been required to use SHA-256 or stronger for this since the industry-wide SHA-1 phase-out.
The fingerprint is a separate, simpler identifier some tools display purely for reference, letting an administrator visually confirm a certificate without reading its full contents. Some older tools still show a SHA-1 fingerprint as a label only, which understandably confuses people into thinking the certificate’s actual security depends on SHA-1. It doesn’t. Chain validation extends this same hashing logic up through every intermediate certificate to the trusted root, and OCSP (Online Certificate Status Protocol) uses hashed certificate identifiers to check revocation status without transmitting the entire certificate. Since 2018, every publicly trusted certificate has also been required to appear in a Certificate Transparency log, a public, cryptographically verifiable record built as a Merkle tree, covered in more depth later in this guide.
In auditing a client’s certificate inventory ahead of a provider migration, this exact distinction mattered directly: three internal certificates displayed SHA-1 fingerprints and were flagged as urgent by an automated scanner, but only one of the three was actually signed with SHA-1. The other two were signed with SHA-256 and only showed a SHA-1 label for legacy identification purposes, a five-minute manual check against each certificate’s actual signature algorithm that avoided reissuing two certificates that never needed it. You can run this same check yourself using our SSL certificate checker, which shows the actual signature algorithm rather than leaving you to interpret a fingerprint.
How Hashing Protects Digital Signatures
Digital signatures rely on hashing for a simple efficiency reason: public-key encryption is computationally expensive, so signing an entire large document directly would be slow. Instead, the signer hashes the document down to a small fixed-size digest and encrypts only that digest with their private key. This same pattern repeats across several distinct signing contexts:
- Code signing hashes an executable or installer, so any tampering after signing is immediately detectable before the operating system runs it.
- Email signing (S/MIME) hashes a message body to prove it wasn’t altered in transit and to confirm the sender’s identity.
- PDF verification embeds a hash of the document’s content at signing time, which is why editing a signed PDF afterward visibly invalidates the signature.
- Software integrity checks, the same mechanism behind the file-verification workflows covered later, depend on this exact hash-then-encrypt pattern to confirm a release hasn’t been modified after publication.
Password Hashing Is Different from File Hashing
File integrity hashing and password hashing have opposite speed requirements, and this is where implementations go wrong most often in practice. A checksum verifying a download needs to run fast, so a large file can be verified in seconds. A password hash needs to run slow, deliberately, so an attacker who steals a database can’t test billions of guesses per second against it.
In 2012, LinkedIn stored 6,458,020 passwords as unsalted SHA-1 hashes, a fast, general-purpose algorithm never designed to resist brute-force cracking. Because there was no salt, identical passwords across different accounts produced identical hashes, and because SHA-1 computes quickly, reporting at the time found that roughly 90% of the exposed hashes were cracked within 72 hours of the leak surfacing. Purpose-built password hashing functions exist specifically to prevent this:
- bcrypt wraps a tunable cost factor directly into its output string, alongside its own salt and digest, making it easy to increase rounds as hardware gets faster.
- scrypt adds a memory-hardness requirement on top of a high iteration count, deliberately consuming a large, tunable amount of RAM per attempt, which is expensive for an attacker to parallelize at scale.
- Argon2, winner of the 2015 Password Hashing Competition, combines configurable time cost, memory cost, and parallelism into one function, and is now OWASP’s default recommendation for new applications.
- PBKDF2 applies a hash function repeatedly, thousands of times, to slow down brute-force attempts; older and less memory-hard than the three above, but still widely supported and FIPS-approved.
Salt, Pepper, and Work Factor Explained
A salt is random data added to each password before hashing, unique per user, so two people with identical passwords end up with completely different stored hashes. This single property is what defeats rainbow tables, precomputed lookup tables mapping common passwords to their hashes, since a rainbow table built for unsalted hashes becomes useless the moment every hash includes a unique salt.
A pepper is a secret value, often stored separately from the database itself, applied to all passwords in addition to individual salts, adding a second layer that survives even if the database (but not the application’s separate configuration) is stolen. Work factor tuning, adjusting bcrypt’s cost parameter or Argon2’s time and memory costs, lets an administrator deliberately slow hashing down as hardware gets faster over time, keeping the computational cost of cracking roughly constant even as attacker hardware improves. Memory-hard hashing, the approach scrypt and Argon2 both take, specifically targets the fact that RAM doesn’t get cheaper nearly as fast as raw compute does, making large-scale parallelized cracking attempts far more expensive than a pure CPU-bound approach would be.
Hashing in Blockchain and Cryptocurrency
Bitcoin uses SHA-256 twice in sequence for its proof-of-work mining process, requiring miners to find an input that produces a hash below a target value, a deliberately brute-force search that secures the network through raw computational cost rather than trust in any single party. Each block also contains the hash of the previous block, which is what makes the chain tamper-evident: changing any historical transaction changes that block’s hash, breaking every subsequent link and immediately revealing the alteration to the entire network.
Within a single block, transactions are organized into a Merkle tree (covered in full detail in the next section), letting a lightweight wallet verify that a specific transaction is included in a block without downloading every transaction in it. Wallet integrity checks lean on this same structure, and transaction verification across the network depends on every node independently recomputing these hashes rather than trusting a central authority’s word for it.
Hashing for File Integrity Verification
When a Linux distribution publishes an ISO alongside a SHA-256 checksum, the goal is simple: after downloading, you hash the file yourself and compare it to the published value. A match confirms the file wasn’t corrupted in transit and wasn’t tampered with by a compromised mirror. This same pattern covers several everyday scenarios:
- Linux package managers verify every package against a recorded hash before installation, rejecting anything that doesn’t match.
- Software release verification lets users confirm a downloaded installer matches exactly what the vendor published, rather than a modified copy from an untrustworthy mirror.
- Backup validation hashes archives before and after storage, catching silent corruption that a simple file-size check would miss entirely.
Because none of this involves secret data, speed is an advantage here rather than a liability, which is why SHA-256 and increasingly BLAKE3 are the standard choices, the opposite of the password hashing guidance covered earlier.
Hash-Based Message Authentication (HMAC)
A plain hash proves data hasn’t changed, but proves nothing about who created it, since anyone can compute a plain hash of any message. HMAC (Hash-based Message Authentication Code) solves this by combining a hash function with a shared secret key, using a specific two-pass structure that prevents a length-extension attack a naive key-plus-message concatenation would be vulnerable to.
This shows up constantly in systems you likely already use:
- API authentication schemes sign requests with HMAC so a server can confirm a request genuinely came from a holder of the shared secret.
- JWTs (JSON Web Tokens) commonly use HMAC-SHA256 to sign the token, letting a server verify it wasn’t tampered with after issuance.
- Payment gateways sign transaction callbacks with HMAC so a merchant’s server can trust that a payment confirmation genuinely came from the processor.
- Webhooks from almost every modern SaaS platform include an HMAC signature header for exactly this same reason.
This is a distinct mechanism from the certificate signatures covered earlier: certificate signatures use asymmetric cryptography, a public and private key pair, while HMAC uses one shared secret both parties already hold in common.
Hash Trees (Merkle Trees) Explained
A Merkle tree hashes data in pairs, repeatedly, until a single root hash represents an entire dataset. This lets anyone verify that one specific piece of data belongs to a much larger set without downloading the whole set, using only a small chain of intermediate hashes called a Merkle proof.
This structure shows up across distributed systems generally, not just cryptocurrency. Git uses a Merkle-tree-like structure internally, every commit’s hash depends on the hashes of its parent commits and the tree of file contents, which is exactly why changing any historical commit changes every commit hash after it. Blockchain systems use it to organize transactions within a block, as covered above. Large database verification systems use Merkle trees to confirm that a replicated dataset matches its source without transferring the entire dataset across the network, only the differing branches of the tree.
This has a direct, underused connection back to the certificate on your own site: Certificate Transparency logs, which every publicly trusted certificate has been required to be submitted to since 2018, store certificate records in exactly this Merkle tree structure, letting anyone independently audit that a log hasn’t silently altered or removed entries.
Where Hash Algorithms Are Used Today
Pulling every use case covered so far into one place, hashing quietly runs underneath:
- SSL/TLS certificates and chain validation
- Code signing and software distribution
- Email security (S/MIME, DKIM)
- Cloud storage deduplication
- Database indexing and lookups
- Password managers and credential storage
- Antivirus signature matching
- Digital forensics and chain-of-custody verification
- Container image identifiers
- Software update verification
The common thread across all ten is the same one this guide keeps returning to: each use case picks its algorithm based on what property it actually needs, speed, security margin, or memory hardness, not based on which algorithm happens to be newest.
Performance Benchmark of Modern Hash Algorithms
| Algorithm | Relative speed | Memory usage | CPU utilization | Security level | Parallelizable? |
|---|---|---|---|---|---|
| MD5 | Fastest | Minimal | Low | None (broken) | No |
| SHA-256 | Moderate | Minimal | Moderate, accelerated by hardware | Strong | No |
| SHA-512 | Fast on 64-bit CPUs | Minimal | Moderate | Strong, larger margin | No |
| SHA3-256 | Slower in software | Minimal | Higher without hardware support | Strong, structurally distinct | Limited |
| BLAKE3 | Fastest of the secure options | Minimal | Scales across cores | Strong | Yes |
| Argon2 | Deliberately slow | High, tunable | High, tunable | Strong for passwords specifically | Limited |
Hardware Acceleration and CPU Support
Intel’s SHA Extensions, available since the Goldmont microarchitecture, accelerate SHA-1 and SHA-256 computation directly in silicon, and ARMv8’s Cryptography Extensions provide equivalent acceleration on mobile and server ARM chips. This hardware support is precisely why SHA-256 remains fast enough for certificate verification on everything from a phone to a load balancer, despite being more computationally intensive per round than MD5.
GPU hashing takes the opposite approach, trading dedicated instructions for massive parallelism, which is exactly why GPUs are so effective at brute-force password cracking against fast, unsalted hashes, and so much less effective against memory-hard functions like Argon2 that deliberately limit how much work can run in parallel. ASICs (Application-Specific Integrated Circuits), purpose-built chips for one specific hashing algorithm, power large-scale Bitcoin mining today precisely because SHA-256 has no memory-hardness requirement standing in their way.
Hash Collision Attacks Explained
The birthday attack is the mathematical reason collision attacks are dramatically easier than preimage attacks: finding any two matching hashes among a large set requires far fewer attempts than finding one specific match, roughly the square root of the total possible outputs rather than the full output space. An identical-prefix collision requires both colliding inputs to share the same starting bytes, while a chosen-prefix collision, the more dangerous and more recent capability demonstrated in both the 2008 MD5 rogue-certificate attack and later SHA-1 research, lets an attacker start from two completely different, legitimate-looking documents and still force them to a shared hash after appending crafted data.
Risk analysis in practice depends entirely on which resistance property is actually threatened for your use case. A collision attack against a password hash accomplishes nothing, since an attacker doesn’t need two colliding inputs, they need to reverse one specific hash, which is a preimage attack, a different and much harder problem. A collision attack against a certificate signature, by contrast, is genuinely dangerous, which is exactly why collision resistance is the property regulators and browser vendors watch most closely.
Quantum Computing and the Future of Hashing
Quantum computers threaten public-key cryptography built on factoring and discrete logarithms far more directly than they threaten hash functions. Grover’s algorithm gives a quantum computer roughly a square-root speedup against a hash function’s preimage resistance, meaning a 256-bit hash retains an effective 128-bit security level against quantum attack rather than being broken outright, unlike RSA and ECDSA, which quantum algorithms can break completely given a sufficiently large quantum computer.
This relative resilience is exactly why NIST built a signature scheme whose security rests solely on hash function properties: SLH-DSA, standardized under FIPS 205 in August 2024, alongside the lattice-based ML-KEM and ML-DSA standards released the same month. NIST has stated it expects organizations to begin transitioning toward post-quantum standards by 2030, with mandatory guidance for federal agencies following in subsequent years. Security margins here matter in a way that’s easy to underestimate: for any organization signing data that needs to remain verifiable decades from now, SLH-DSA is currently the only production-ready signature standard that doesn’t depend on an assumption quantum computing is actively working to defeat.
Regulatory and Compliance Requirements
Several major frameworks now name specific hash algorithm requirements directly, rather than leaving the choice open:
- FIPS 180-4 defines NIST’s approved SHA-2 family algorithms for federal use.
- FIPS 202 defines SHA-3 and its underlying Keccak specification.
- PCI DSS, governing payment card data, requires strong cryptography for storing cardholder data and has long since disqualified MD5 and SHA-1 from that role.
- HIPAA doesn’t name an algorithm directly, but its security rule requires industry-standard cryptographic protection for health information, which rules out MD5 and SHA-1 for any new implementation in practice.
- GDPR takes a similar approach, requiring appropriate technical measures without naming a specific algorithm, which places the burden of justifying that choice on the organization if a breach occurs while an outdated algorithm was in use.
- eIDAS, the EU regulation governing electronic identification and trust services, requires qualified electronic signatures to use algorithms that meet specific published security levels, which excludes MD5 and SHA-1 outright.
Choosing the Right Hash Algorithm by Use Case
| Use case | Recommended algorithm | Why |
|---|---|---|
| Password storage | Argon2id, bcrypt, or scrypt | Deliberately slow, salted, resists GPU cracking |
| SSL/TLS certificates | SHA-256 or stronger | Required by every public root program |
| Code signing | SHA-256 | Matches TLS signature requirements |
| APIs and webhooks | HMAC-SHA256 | Authenticates sender, not just integrity |
| Blockchain | SHA-256 (Bitcoin), Keccak (Ethereum) | Network-specific consensus requirements |
| File verification | SHA-256 or BLAKE3 | Fast, collision-resistant, widely supported |
| Digital signatures | SHA-256 today, SLH-DSA for long-term archival | Matches expected verification lifespan |
| Database indexing | Non-cryptographic hash (e.g., MurmurHash) | No security need, speed matters most |
| Deduplication | BLAKE3 or SHA-256 | Fast, low collision risk at scale |
Common Mistakes Developers Still Make
- Using MD5 for anything security-related, including password storage, purely out of habit or outdated tutorials.
- Storing passwords unsalted, which turns identical passwords into identical, instantly comparable hashes across an entire database.
- Using a fast hash for passwords, applying SHA-256 directly instead of a purpose-built slow function, recreating the exact vulnerability the LinkedIn breach demonstrated at scale.
- Truncating hashes to save storage space, which reduces the effective security level far more than the saved space is ever worth.
- Comparing hashes with a standard equality check instead of a constant-time comparison function, which can leak timing information an attacker can exploit to guess a correct value byte by byte.
- Using weak or predictable salts, including reusing the same salt across every user, which defeats the entire purpose of salting in the first place.
Migration Strategy from Legacy Hash Algorithms
Migrating away from a legacy hash algorithm works best as a phased rollout rather than a single cutover. In moving a mid-sized e-commerce client’s authentication system off unsalted SHA-1 password storage, a dual-verification period ran for one full login cycle: new logins were rehashed into bcrypt immediately, while existing accounts were transparently upgraded the next time each user successfully authenticated, avoiding a disruptive mass password reset. The migration completed for roughly 95% of active accounts within that single cycle, with only long-dormant accounts requiring a forced reset afterward.
The same phased principle applies to certificate signature algorithms migrating from SHA-1 to SHA-256, and to any general MD5 replacement project: audit what’s actually running before assuming a migration is needed, since many systems already default to SHA-256 and simply haven’t confirmed it, then maintain backward compatibility during the transition window rather than forcing every client or user through a hard cutover on a single day.
Practical Tools to Generate and Verify Hashes
Every major platform ships a built-in way to generate and check hashes without installing anything extra:
- OpenSSL:
openssl dgst -sha256 filenameworks identically across Linux, macOS, and Windows with OpenSSL installed. - Windows PowerShell:
Get-FileHash filename -Algorithm SHA256returns the digest directly in the terminal. - Linux:
sha256sum filenamecompares directly against a published checksum file. - macOS:
shasum -a 256 filenameis the macOS equivalent, sincesha256sumisn’t included by default. - Online verification tools exist for quick one-off checks, but avoid pasting sensitive or confidential files into any third-party site, since you have no guarantee what happens to that data afterward, use a local command-line tool for anything you wouldn’t want exposed.
Frequently Asked Technical Questions
Can two files have the same SHA-256 hash? In theory, yes, since SHA-256 has a finite output space and infinite possible inputs. In practice, no collision has ever been demonstrated against SHA-256, and finding one would require computational resources far beyond anything available today.
Why is Argon2 recommended over SHA-256 for passwords? SHA-256 is fast by design, which is exactly wrong for password storage. Argon2 is deliberately slow and memory-hard, making large-scale brute-force cracking economically impractical even against a stolen database.
Is SHA-3 replacing SHA-2? No. SHA-3 exists as a structurally independent backup, not a replacement. SHA-256 remains the required standard for TLS certificates and shows no signs of being displaced.
Can quantum computers break SHA-256? Not outright. Grover’s algorithm reduces its effective security level from 256 bits to roughly 128 bits, which remains strong, unlike RSA and ECDSA, which quantum algorithms can break completely.
What’s the difference between a checksum and a cryptographic hash? Every cryptographic hash can serve as a checksum, but not every checksum is cryptographically secure. A basic checksum like CRC32 detects accidental corruption but offers no resistance to deliberate tampering; a cryptographic hash resists both.
Does hashing encrypt data? No. Hashing is one-way and irreversible by design; encryption is two-way and reversible with the correct key. They solve different problems entirely.
How are certificate fingerprints generated? A fingerprint is simply a hash, often SHA-1 or SHA-256, computed over the certificate’s raw DER-encoded bytes, used purely as a short identifier for manual verification rather than as part of the certificate’s actual cryptographic security.
