World’s largest virtual agentic engineering & quality conference

WHENAUG 19-21
WHEREVirtual · Global
Register Now
Automation TestingTesting

What Is Hashing? A Complete Guide

Hashing explained: how hash functions work, hash tables vs. cryptographic hashing, algorithm comparisons, collisions, salting, and how to generate a hash.

Author

Mythili Raju

Author

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

  • Hash function: the algorithm that performs the conversion - deterministic, fixed-output-size, and one-way for cryptographic use cases.
  • Two distinct use cases: fast data-structure lookups (hash tables, O(1) average time) and tamper-evident security (password storage, file integrity, digital signatures) - the same underlying idea, very different requirements.
  • Hashing vs. encryption: encryption is reversible with a key; hashing is intentionally one-way, which is exactly why it's used for passwords instead of encryption.
  • Collisions: two different inputs producing the same hash - mathematically inevitable given unlimited inputs and a fixed output size, but a secure algorithm makes finding one computationally infeasible.
  • Salting: random data mixed into an input before hashing it, so identical inputs produce different hashes - the standard defense against precomputed lookup-table attacks.

What Is Hashing?

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

Note: Generate a hash instantly with TestMu AI's free MD5, SHA-256, SHA-1, and bcrypt calculators. Try the Hash Calculator

How Does Hashing Work?

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.

Data Structure Hashing vs. Security Hashing

Most explanations of hashing pick one of these two use cases and stop, which leaves out why the requirements are so different:

  • Hash tables (data structures): a hash function maps a key to an index in an array, giving average O(1) time for lookups, inserts, and deletes. Speed is the priority here - collisions are handled with chaining or open addressing, and the hash function doesn't need to resist a deliberate attacker, just distribute keys evenly.
  • Cryptographic hashing (security): the priority flips entirely. The function needs to be slow enough (or deliberately slowed, as with bcrypt) to resist brute-force guessing, and it needs to make finding a deliberate collision computationally infeasible, not just statistically unlikely.

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.

Common Hashing Algorithms Compared

AlgorithmOutput SizeTypical UseCurrent Status
MD5128-bitLegacy checksums, non-security file comparisonBroken - practical collisions published; do not use for security
SHA-1160-bitLegacy digital signatures, older Git internalsBroken - practical collisions published; deprecated for security
SHA-256 / SHA-3256-bitFile integrity, digital signatures, blockchainSecure, but fast - not for password storage on its own
bcrypt184-bit (Blowfish-based)Password storageSecure - deliberately slow, includes a built-in salt
CRC3232-bitError detection in file transfers and archivesNot 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.

Test across 3000+ browser and OS environments with TestMu AI

Hashing vs. Encryption

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.

Real-World Applications of Hashing

  • Password storage: systems store a salted hash of a password, never the password itself, so a stolen database doesn't hand over readable credentials directly.
  • File integrity verification: comparing a downloaded file's hash against a published checksum confirms the file wasn't corrupted or tampered with in transit.
  • Digital signatures: a document is hashed, and the hash - not the whole document - is what gets signed, since signing a small fixed-size hash is far faster than signing arbitrary-length data.
  • Hash tables and caching: programming languages use hashing internally for dictionaries, sets, and caches, trading a small amount of memory for average constant-time lookups.
  • Blockchain: each block includes the hash of the previous block, so altering any historical block changes its hash and breaks every subsequent link in the chain.

Hash Collisions Explained

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.

How to Generate a Hash

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.

Conclusion

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 Raju

Blogs: 47

  • Twitter
  • Linkedin

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

Reviewer

  • Linkedin

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.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free
...
TestMu Conf 2026

World's largest virtual agentic engineering & quality conference

...

AUG 19-21, 2026

REGISTER NOW

What Is Hashing FAQs

Did you find this page helpful?

More Related Blogs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests