World’s largest virtual agentic engineering & quality conference
Hashing explained: how hash functions work, hash tables vs. cryptographic hashing, algorithm comparisons, collisions, salting, and how to generate a hash.

Mythili Raju
Author

Sandeep Yadav
Reviewer
Last Updated on: August 10, 2026
Compromised credentials were the initial access vector in 22% of breaches reviewed in Verizon's 2025 Data Breach Investigations Report. Every one of those incidents happened to a system that, in theory, never stored a readable password in the first place - because the standard practice for a decade has been to store a hash of the password, not the password itself.
That's one use of hashing. It's also how a hash table looks up a value in constant time, how a downloaded file gets verified against tampering, and how a blockchain links one block to the next. This guide covers what hashing actually is, how it differs from encryption, how the main algorithms compare, and where the two very different use cases - fast data structures versus tamper-evident security - actually diverge.
Overview
Hashing is a process that converts input data of any size into a fixed-length string of characters, called a hash, using a mathematical function. The same input always produces the same hash, a tiny change to the input produces a completely different hash, and - for a well-designed hash function - there's no practical way to reverse the hash back into the original input.
Core Concepts in This Guide
Hashing is the process of running data of any length through a mathematical function - a hash function - that returns a fixed-length string of characters, called a hash, hash value, or digest. Feed it a single word or an entire multi-gigabyte file, and the output is the same fixed length either way.
Three properties define a useful hash function: the same input always produces the same output (deterministic), a tiny change to the input produces a completely different output (the avalanche effect), and for cryptographic hash functions specifically, there's no practical way to work backward from the hash to the original input.
Note: Generate a hash instantly with TestMu AI's free MD5, SHA-256, SHA-1, and bcrypt calculators. Try the Hash Calculator
A quick way to see the avalanche effect in action - hashing the same word with one character changed, using SHA-256:
import hashlib
print(hashlib.sha256(b"password").hexdigest())
# 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
print(hashlib.sha256(b"Password").hexdigest())
# e7cf3ef4f17c3999a94f2c6f612e8a888e5b1026878e4e19398b23bd38ec221a
Capitalizing one letter changes every character of the resulting hash. There's no partial similarity between the two outputs to exploit, which is precisely the point - if hashes of similar inputs looked similar, an attacker could narrow down a search instead of trying every possibility.
Most explanations of hashing pick one of these two use cases and stop, which leaves out why the requirements are so different:
Using a fast, non-cryptographic hash function for passwords, or a slow cryptographic function inside a performance-critical hash table, both miss the point of why each was designed the way it was. Hash tables specifically are also one of the most frequently asked topics in technical interviews - see our data structures interview questions for how they typically come up.
| Algorithm | Output Size | Typical Use | Current Status |
|---|---|---|---|
| MD5 | 128-bit | Legacy checksums, non-security file comparison | Broken - practical collisions published; do not use for security |
| SHA-1 | 160-bit | Legacy digital signatures, older Git internals | Broken - practical collisions published; deprecated for security |
| SHA-256 / SHA-3 | 256-bit | File integrity, digital signatures, blockchain | Secure, but fast - not for password storage on its own |
| bcrypt | 184-bit (Blowfish-based) | Password storage | Secure - deliberately slow, includes a built-in salt |
| CRC32 | 32-bit | Error detection in file transfers and archives | Not cryptographic - fast, collision-prone by design, security-inappropriate |
The pattern across this table: the algorithms still considered secure for passwords (bcrypt, and its newer alternatives scrypt and Argon2) are deliberately slow. Every algorithm optimized for speed - MD5, CRC32, even plain SHA-256 - is the wrong choice for hashing a password, because speed is exactly what makes brute-force guessing cheap.
The two are frequently confused because both scramble readable data into something unreadable, but they solve opposite problems. Encryption is designed to be reversed - anyone with the right key can decrypt the ciphertext back to the original plaintext. Hashing is designed to never be reversed at all.
That's why a login system hashes passwords instead of encrypting them: even the system storing the hash shouldn't be able to recover the original password, not even with a key. Encryption is the right tool when the original data needs to come back later - a file at rest, a message in transit. Hashing is the right tool when you only ever need to verify a match, never retrieve the original.
A hash function maps an infinite range of possible inputs onto a fixed-size output - SHA-256 always produces 256 bits, no matter how large the input. Since there are more possible inputs than possible outputs, two different inputs producing the same hash is mathematically guaranteed to happen eventually. That's a collision.
A secure algorithm doesn't prevent collisions from existing - it makes them computationally infeasible to find on purpose. MD5 and SHA-1 both failed this property: researchers published practical methods to deliberately construct two different inputs with the same hash, which is why neither is trusted for security purposes anymore, even though both are still fine for non-security uses like a quick file-comparison checksum.
For quick, one-off hashing without writing code, TestMu AI provides free calculators for the algorithms covered in this guide: MD5, SHA-1, SHA-256, bcrypt, CRC32, and NTLM, alongside a general-purpose hash calculator covering additional algorithms in one place.
In code, most languages expose hashing through a standard library rather than a third-party dependency - Python's hashlib, used in the example earlier in this guide, is a typical example. For password hashing specifically, reach for a dedicated library (like bcrypt in Python or Node.js) instead of hand-rolling a general-purpose hash function with manual salting.
Hashing is one concept serving two different jobs: fast, unordered lookups in a hash table, and one-way, tamper-evident verification in security contexts. Confusing which algorithm fits which job - using a fast hash for passwords, or a slow one where speed actually matters - is the most common mistake in how hashing gets used in practice.
Generate a hash with any of TestMu AI's free calculators linked above. If hashing shows up in your own test suite - validating file integrity checksums, or confirming a login system correctly rejects a reused password hash - the same verification patterns apply whether you're doing API testing or security testing more broadly.
Author
Mythili is a Community Contributor at TestMu AI with 3+ years of experience in software testing and marketing. She holds certifications in Automation Testing, KaneAI, Selenium, Appium, Playwright, and Cypress. At TestMu AI, she leads go-to-market (GTM) strategies, collaborates on feature launches, and creates SEO optimized content that bridges technical depth with business relevance. A graduate of St. Joseph’s University, Bangalore, Mythili has authored 35+ blogs and learning hubs on AI-driven test automation and quality engineering. Her work focuses on making complex QA topics accessible while aligning content strategy with product and business goals.
Reviewer
Sandeep Yadav is a Senior Software Engineer at TestMu AI (formerly LambdaTest), where he builds the platform's test intelligence and AI-native engineering systems. He has architected autonomous GitHub Apps, vector-search code intelligence, and self-diagnosing QA workflows, and designed distributed platforms that process 2M+ daily test executions and 1B+ events, turning high-volume test, log, and code data into intelligent, self-optimizing systems. He works on embedding reasoning models into production infrastructure to power autonomous review, root-cause analysis, and analytics workflows. He brings over four years of engineering experience with deep expertise in the Elastic Stack, Apache Kafka, and Redis. Earlier he engineered a GDPR-compliant, end-to-end-encrypted secure web-chat application at Mithi. A Facebook Hackercup 2021 Round 2 qualifier and merit-scholarship recipient, Sandeep holds a B.Tech in Electrical Engineering from Delhi Technological University.
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance