A hashing algorithm turns data of any size into a fixed-length, one-way digest that should never be reversible. For integrity checks, use SHA-256 or better. For password storage, use a memory-hard function like Argon2id, never a bare fast hash. Both NIST and RFC 9106 back this split, and skipping it is the single most common mistake in production systems today.
TL;DR:
- Use SHA-256 or SHA-3 for file integrity checks, as MD5 and SHA-1 are deprecated due to collision vulnerabilities.
- Implement Argon2id with unique salts and parameter storage for secure password hashing, avoiding simple fast hashes like SHA-256 alone.
- When verifying message authenticity, always use HMAC with a secure hash, not concatenation, to prevent length-extension attacks.
- Rely on well-established cryptographic libraries and revisit hashing parameters periodically to stay ahead of evolving hardware capabilities.
- Reserve non-cryptographic hashes like xxHash or MurmurHash for internal, non-adversarial use cases such as checksums or indexing.
Table of Contents
- What Makes a Hashing Algorithm Cryptographically Secure
- MD5, SHA-1, SHA-2, SHA-3, BLAKE2, and Argon2 Compared
- Where Each Hashing Algorithm Actually Gets Used
- How Should Teams Implement Hashing Securely?
- Common Mistakes When Implementing Hashing Algorithms
- How to Generate and Verify Hashes in Practice
- Your Hashing Algorithm Checklist Before You Ship
- Why Standards Beat Trends in Cryptographic Hashing
- Test Your Hashes Without Touching Production Secrets
- Standards Worth Bookmarking for Hashing Algorithms
- Sources
- FAQ
What Makes a Hashing Algorithm Cryptographically Secure
Not every hash function deserves the word "secure." A cryptographic hash needs to satisfy a specific set of properties, and if it fails even one, attackers will find the gap eventually. Understanding these properties is the difference between picking a hash function because it sounds familiar and picking one because it actually fits the job.
Collision resistance means it should be computationally infeasible to find two different inputs that produce the same digest. This is the property that broke MD5 and SHA-1: researchers found practical ways to generate colliding inputs, which makes both algorithms unsafe anywhere an attacker could exploit a forged match, like digital signatures or certificate validation.

Preimage resistance is different. Given a digest, you shouldn't be able to work backward to find the original input. This is what makes password hashing viable at all. If preimage resistance failed, an attacker with your password database could simply reverse the digests instead of guessing at them.
Second preimage resistance sits between the two: given one input, an attacker shouldn't be able to find a different input that hashes to the same value. It sounds similar to collision resistance, but the attack scenarios differ enough that standards treat them as separate requirements.
Then there's the avalanche effect. Flip a single bit in the input, and roughly half the output bits should change. This is what makes a hash function useful for detecting tampering. A one-character edit to a file should produce a digest that looks nothing like the original.
Two properties round out the list: determinism (the same input always produces the same digest) and fixed output size (SHA-256 always returns 256 bits, whether you hash one character or a ten-gigabyte file).
- Collision resistance: no two inputs should map to the same digest
- Preimage resistance: the digest shouldn't reveal the input
- Second preimage resistance: no swapping in a different input with the same hash
- Avalanche effect: small input changes cause large, unpredictable output changes
- Determinism: identical inputs always produce identical digests
- Fixed output size: digest length stays constant regardless of input size
Here's where a lot of confusion sets in: not every hash function needs all of this. Non-cryptographic hashes like xxHash or MurmurHash are built for speed, not security. They're excellent for hash tables, checksums against accidental corruption, or deduplication indexes where nobody is actively trying to forge a match. Using one of these where an adversary might try to exploit a collision is a mistake; using a cryptographic hash where raw speed matters more than security is just wasted CPU cycles.
Pro Tip: If your use case involves any human adversary, whether it's an attacker trying to forge a checksum or a user trying to fake an integrity proof, default to a cryptographic hash. If it's purely internal performance tuning with no adversarial model, a fast non-cryptographic hash is often the better engineering choice.
One more distinction trips people up constantly: hashing alone does not provide authentication. A hash proves data hasn't changed, but it says nothing about who produced it. If you need to verify that a message came from someone holding a specific secret, you need a MAC (message authentication code) such as HMAC, or a full digital signature scheme. Hashing and authentication solve different problems, and conflating them is how integrity checks get bypassed.
MD5, SHA-1, SHA-2, SHA-3, BLAKE2, and Argon2 Compared
Six names dominate any real conversation about hashing algorithms, and each occupies a distinct place in the timeline of cryptographic trust. Some are historical footnotes now. Others are the current baseline. One isn't a general-purpose hash at all.
MD5 was the workhorse hash of the 1990s and early 2000s, producing a 128-bit digest. It's fast and still shows up in legacy checksums, but researchers demonstrated practical collision attacks years ago. NIST considers MD5 broken for collision resistance, and it has no place in any security-sensitive system built today.
SHA-1 followed the same arc. Its 160-bit digest was the internet's default for over a decade, used in TLS certificates, Git commits, and software signing. Then came the SHAstic collision demonstration, and NIST formally retired SHA-1 for federal use, recommending SHA-256 as the baseline replacement.
SHA-2 is where most modern systems live. It's a family, not a single algorithm: SHA-224, SHA-256, SHA-384, and SHA-512 differ mainly in digest size and internal word size. SHA-256 has become the de facto standard for file integrity, TLS certificates, and blockchain applications, largely because it balances strong collision resistance with reasonable computational cost. It's defined formally in FIPS 180-4.
SHA-3, standardized separately in FIPS 202, uses a completely different internal structure called a sponge construction rather than the Merkle-Damgård design behind SHA-1 and SHA-2. That structural independence is the whole point: if a future flaw is ever found in SHA-2's design approach, SHA-3 doesn't inherit it. NIST's own guidance is clear that there's no urgent need to migrate from SHA-2 to SHA-3 today; SHA-2 remains fully acceptable, and SHA-3 exists as an approved, structurally distinct alternative. SHA-3 also introduces XOFs, extendable-output functions like SHAKE128 and SHAKE256, which let you generate a digest of any length you specify rather than a fixed size.

BLAKE2 isn't a NIST standard, but it's widely trusted in practice, often faster than SHA-2 on modern hardware while offering comparable security margins. It shows up in tools like WireGuard and Argon2's own internals. For non-adversarial or performance-sensitive integrity work where you still want cryptographic guarantees, BLAKE2 is a legitimate option.
Argon2 doesn't compete with the others on this list because it isn't solving the same problem. It's a key derivation function purpose-built for password hashing, and it won the Password Hashing Competition for good reason: it's memory-hard, meaning it deliberately consumes large amounts of RAM to make GPU and ASIC-based cracking attacks expensive. RFC 9106 documents three variants, Argon2d, Argon2i, and Argon2id, and recommends Argon2id as the default choice because it hybridizes resistance to both side-channel attacks and time-memory trade-off attacks.
| Algorithm | Digest size | Status | Typical use |
|---|---|---|---|
| MD5 | 128 bits | Broken, deprecated | Legacy checksums only |
| SHA-1 | 160 bits | Deprecated for security | Legacy interop only |
| SHA-256 (SHA-2) | 256 bits | Current baseline | File integrity, TLS, signatures |
| SHA-512 (SHA-2) | 512 bits | Current, stronger margin | High-security integrity |
| SHA3-256 (SHA-3) | 256 bits | Current, alternative structure | Same as SHA-256 where diversity is wanted |
| BLAKE2 | Configurable | Current, non-NIST | Fast non-adversarial or general hashing |
| Argon2id | Configurable | Current standard | Password hashing only |
Where Each Hashing Algorithm Actually Gets Used
The right algorithm depends entirely on what job you're asking it to do. Treating "hashing" as one interchangeable tool is how weak choices end up in production.
File integrity and checksums. If you're building a new system that verifies downloads, backups, or file transfers haven't been corrupted or tampered with, SHA-256 is the practical default. MD5 checksums still appear in some legacy tooling and package managers, but that's compatibility, not endorsement. A comparison of SHA-256 against MD5 consistently shows SHA-256's longer digest and stronger collision resistance winning out for any new integrity workflow.
Password storage. This is the case where general-purpose hashing algorithms actively hurt you. SHA-256 computes billions of times per second on commodity GPUs, which means an attacker with a stolen password database can try enormous numbers of guesses per second. Argon2id, by design, makes each guess expensive in both time and memory. Every stored password record should include the algorithm name, version, and tuning parameters alongside the salt and digest, something like argon2id$v=19$m=65536,t=3,p=4$[salt]$[hash], so the system can identify how each record was hashed and migrate it later without breaking authentication.
Digital signatures and certificates. Signature schemes hash the message first, then sign the digest. If the hash function underneath is collision-prone, an attacker can craft two documents with the same signature, one legitimate and one malicious. This is exactly why SHA-1 was pulled from certificate authorities and code-signing pipelines industry-wide.
Content addressing and deduplication. Systems that identify data by its hash rather than a filename, think Git commits or content-addressable storage, rely on the digest being both deterministic and collision-resistant. Two identical files must always produce the same hash, and two different files must essentially never collide. Canonicalization matters here too: even trivial formatting differences change the input bytes and produce a completely different digest.
Blockchain and proof-of-work. Cryptocurrencies use hashing algorithms differently than most applications: the goal isn't just resisting collisions, it's controlling computational difficulty. Bitcoin's proof-of-work uses SHA-256 specifically because its speed and predictable cost per attempt make mining difficulty tunable. That same speed would be a liability in password hashing, which is exactly why domain context matters more than picking "the strongest" algorithm in the abstract.
- File integrity: SHA-256 for new systems, MD5 only where legacy tools require it
- Passwords: Argon2id with unique salts and stored parameters, never a bare hash
- Signatures and certificates: SHA-256 or SHA-3, never SHA-1
- Content addressing: deterministic digests plus consistent canonicalization
- Blockchain: domain-specific speed and difficulty requirements, not general security ranking
How Should Teams Implement Hashing Securely?
Security guidance is only useful if it turns into concrete engineering decisions. Here's the checklist that separates teams who get hashing right from teams who patch it after an incident.
-
Default to SHA-256 or stronger for anything involving integrity or authentication. NIST's retirement notice for SHA-1 isn't a suggestion, it's a formal signal that SHA-1 and MD5 no longer meet modern collision-resistance requirements. Audit existing systems for both before building anything new.
-
Use Argon2id for password hashing, with unique random salts per user and no reused salts across records. RFC 9106 recommends a baseline configuration around 2 GiB of memory with a time cost of 1 for high-security contexts, though the right numbers depend on your server's available RAM and acceptable login latency. Store the parameters with the hash so you can adjust them later without locking yourself out of old records.
-
Use HMAC, not string concatenation, when you need message authentication. Simply hashing a secret key appended to a message is vulnerable to length-extension attacks against Merkle-Damgård based hashes like SHA-256. HMAC-SHA-256 avoids this entirely and is the standard choice for API request signing and token verification.
-
Use vetted cryptographic libraries, never hand-rolled implementations. Every mainstream language ships production-grade hashing support: Python's
hashlib, Node'scryptomodule, Java'sMessageDigest. Rolling your own hash function or KDF logic is one of the most reliable ways to introduce a subtle, exploitable bug. -
Document your parameters and revisit them periodically. Memory-hard function costs are meant to scale with hardware. What was expensive for an attacker in 2020 might be trivial by 2028. Build a rehash-on-login strategy so you can silently upgrade old password hashes to stronger parameters as users authenticate.
Pro Tip: When tuning Argon2id, test in a staging environment that mirrors your production server's memory limits. A configuration that takes 400 milliseconds on your laptop might take four seconds, or exhaust available memory, on a constrained production container. Measure before you deploy.
Choosing Argon2 parameters isn't guesswork. RFC 9106 lays out memory-hard function guidance with concrete trade-offs between memory cost, time cost, and parallelism, and increasing memory cost tends to buy more real-world security than increasing time cost alone, since memory is the expensive resource for attackers running parallel cracking rigs on GPUs.
Common Mistakes When Implementing Hashing Algorithms
Most hashing failures aren't algorithm failures. They're implementation failures wrapped around a perfectly good algorithm.
The most persistent mistake is hashing passwords with a bare fast function, usually SHA-256 or even MD5, sometimes with a single global salt or no salt at all. This defeats the entire purpose of hashing. Fast, general-purpose hashes are built for speed, which is exactly the wrong property for something an attacker wants to brute-force.
Migration from legacy hashes causes its own headaches. Moving a live system from SHA-1 or MD5 to SHA-256 without breaking existing records usually calls for a dual-read strategy: verify against the old hash on login, then immediately rehash with the new algorithm and store both the digest and a version marker. Backfilling historical records requires access to the original plaintext or file, which for passwords means you can only migrate as users log in, never in a batch job.
Encoding and canonicalization errors are a quieter but equally common trap. Two files that look identical to a human can produce different hashes if one uses UTF-8 and the other UTF-16, or if line endings differ between Windows and Unix systems. Unicode normalization matters too: a string can be visually identical but byte-for-byte different depending on which normalization form it uses, and that changes the hash completely.
Not every hash needs cryptographic strength, and treating every checksum like a security boundary wastes performance. Non-cryptographic hashes like xxHash or MurmurHash are appropriate for hash table indexing, load balancing, or detecting accidental (not adversarial) corruption. They run many times faster than SHA-256 and were never meant to resist a determined attacker.
- Never hash passwords with SHA-256, MD5, or any fast general-purpose hash alone
- Use dual-read migration strategies when moving off deprecated algorithms
- Watch for UTF-8 vs UTF-16 and normalization mismatches before hashing
- Reserve xxHash or MurmurHash for non-adversarial indexing and checksums
- Add monitoring for hash computation latency to catch performance regressions early
How to Generate and Verify Hashes in Practice
Testing a hash function doesn't require much setup. A handful of commands cover most day-to-day needs.
From the command line, openssl dgst -sha256 filename.txt produces a SHA-256 digest instantly, and sha256sum filename.txt does the same on most Linux distributions. In Python, three lines handle it: import hashlib, then hashlib.sha256(data).hexdigest(). Node.js developers get equivalent functionality from the built-in crypto module: crypto.createHash('sha256').update(data).digest('hex').
When storing password hashes, structure the record with clear metadata rather than a raw digest alone. A typical schema includes the algorithm name, version, tuning parameters, salt, and hash, stored together as a single string or as separate database columns. That metadata is what lets you upgrade parameters later without breaking every existing account.
Pro Tip: Never paste a production password or sensitive file into an unfamiliar online hashing tool. Even if the tool claims not to log input, you have no way to verify that. Use local command-line tools or trusted, transparent utilities for anything touching real secrets, and reserve online generators for learning, testing, and demonstration data.
For exactly that kind of safe experimentation, Pingfloat's Hash Generator computes MD5, SHA-1, SHA-256, and SHA-512 digests instantly in the browser, which makes it useful for comparing algorithm outputs side by side or checking a downloaded file's checksum. Pairing it with a strong, randomly generated password during testing keeps sample credentials from doubling as real ones.
openssl dgst -sha256 file.txtfor quick command-line digestssha256sum file.txton most Linux systems- Python's
hashlib.sha256()for scripted or application-level hashing - Node's
crypto.createHash('sha256')for JavaScript environments - Store algorithm, version, parameters, salt, and digest together for passwords
Your Hashing Algorithm Checklist Before You Ship
Run a quick audit before your next release touches anything involving integrity checks, passwords, or signatures.
- Search your codebase for MD5 and SHA-1 usage; flag anything security-sensitive for migration
- Confirm file integrity and checksum logic uses SHA-256 or a SHA-3 variant
- Confirm password storage uses Argon2id with unique salts and stored parameters, never a bare hash
- Confirm any message authentication uses HMAC with a modern hash, not manual concatenation
- Add a rehash-on-login path so password parameters can be upgraded without forcing resets
- Document your chosen parameters somewhere your future team can actually find them
Getting this right isn't about chasing the newest algorithm. It's about matching a well-understood, standards-backed tool to the job it was actually designed for.
Why Standards Beat Trends in Cryptographic Hashing
The biggest misconception about hashing algorithms is that newer automatically means better. Developers see SHA-3 exists and assume they should migrate off SHA-256 immediately, when NIST's own policy says the opposite: SHA-2 remains fully acceptable, and there is no urgent case for switching. Chasing the newest primitive without a specific reason wastes engineering time that would be better spent fixing an actual weak spot, like a password table still running bare SHA-256 from 2015.
The gap that actually matters isn't between SHA-2 and SHA-3. It's between teams that treat password hashing and file integrity as the same problem, and teams that don't. A fast hash and a memory-hard function solve opposite problems: one needs to be quick, the other needs to be expensive. Conflating them is where most real damage happens.
Good tooling closes that gap in practice, not just in theory. Testing digests against known values, comparing algorithm outputs, or generating a strong password for a staging environment shouldn't require standing up a local script every time. That's the gap Pingfloat's Hash Generator and Password Generator fill: fast, transparent utilities for the kind of verification work that standards documents describe but rarely make easy.
— Andreas
Test Your Hashes Without Touching Production Secrets
Reading about SHA-256 versus Argon2id is one thing. Actually seeing a digest change when you flip one character, or generating a password strong enough to survive a real credential-stuffing attempt, is what makes the concepts stick. Pingfloat's free Hash Generator computes MD5, SHA-1, SHA-256, and SHA-512 digests side by side in your browser, no installation, no account required, so you can compare algorithm behavior or verify a file checksum in seconds.

Pair it with the Password Generator when you need a strong credential for a test account or a staging environment, instead of typing something predictable by hand. Both tools run instantly and free, alongside the rest of Pingfloat's developer utility suite, covering everything from SSL checks to JSON formatting. Open the Hash Generator now and run your first digest comparison in under a minute.
Standards Worth Bookmarking for Hashing Algorithms
Every claim about algorithm security in this article traces back to a small set of primary documents, and they're worth keeping close if you're making implementation decisions professionally.
- NIST's hash functions project page tracks the official status of SHA-2, SHA-3, and related standards, including deprecation notices.
- FIPS 180-4 defines the SHA-2 family formally, including SHA-256 and SHA-512 specifications and test vectors.
- FIPS 202 defines SHA-3 and the SHAKE128/256 extendable-output functions.
- RFC 9106 is the authoritative specification for Argon2, including the Argon2id variant and recommended parameter settings.
- NIST's policy on hash function transitions explains when migration between SHA-2 and SHA-3 is actually necessary.
Sources
- NIST — Projects: Hash Functions
- NIST retires SHA-1 cryptographic algorithm (news release)
- RFC 9106 — Argon2 memory-hard function
- FIPS 202 — SHA-3 Standard: Permutation-Based Hash and XOFs
FAQ
What Is the Difference Between SHA-1 and SHA-256?
SHA-1 produces a 160-bit digest and has been broken for collision resistance, meaning attackers can craft two different inputs that produce the same hash. SHA-256, part of the SHA-2 family, produces a 256-bit digest and remains a current, NIST-approved baseline for integrity and security applications.
Is SHA-256 Better Than MD5?
Yes, significantly. MD5 produces a shorter 128-bit digest and has well-documented collision vulnerabilities, while SHA-256 offers a longer digest and much stronger collision resistance, making it the practical choice for any new integrity or security workflow.
Which Hashing Algorithm Is No Longer Recommended?
Both MD5 and SHA-1 are no longer recommended for security-sensitive uses. NIST formally retired SHA-1 for federal applications, and MD5 has known practical collision attacks, so both should only appear in legacy compatibility contexts, never in new systems.
Is Hashing Still Relevant Today?
Yes, hashing remains foundational to modern computing, underpinning password storage, file integrity checks, digital signatures, and blockchain systems. What has changed is which algorithms are considered safe: SHA-256 and SHA-3 have replaced MD5 and SHA-1, and Argon2id has replaced fast hashes for password storage specifically.
Can I Test Hashing Algorithms Without Writing Code?
Yes. Pingfloat's Hash Generator lets you compute MD5, SHA-1, SHA-256, and SHA-512 digests directly in your browser for free, which is useful for learning how the avalanche effect works or verifying a downloaded file's checksum without installing any software.
