Developer

What Is a Hash? MD5, SHA-1, and SHA-256 Differences and Uses Explained

A hash value is a foundational technology behind modern IT, used for tamper detection of files and the safe storage of passwords. This article explains what a hash is, its properties such as one-way and fixed-length, the differences and uses of MD5, SHA-1, and SHA-256, salting, how it differs from encryption, and the risk of collisions.

Published: 2026-10-16

Have you ever seen a long string like "SHA-256: a1b2c3..." when downloading software? Or read "passwords are stored hashed" when signing up for a web service? What these share in common is the hash value. This article explains, step by step and for beginners, what a hash value is, what properties it has, and where it is useful.

What Is a Hash Value

A hash value is a fixed-length, short value obtained by passing arbitrary data (a string or a file) through a calculation procedure called a hash function. It is also called a "digest," "message digest," or "fingerprint." Even a single character difference in the input produces a completely different hash value.

For example, hashing the string "hello" with SHA-256 yields a 64-character hexadecimal string. The same "hello" always produces the same hash value, no matter when or in what environment you compute it. Because a hash function follows a fixed set of rules, the result can serve as a "summary" or "proof of identity" for the data.

An important point is that a hash value is not "compression" that shrinks data for storage. You cannot recover the original data from a hash value. Think of it as a mechanism for creating a correspondence that says "this data maps to this value."

Three Properties of a Hash Value

Hash functions are useful because they have the following three properties, which are also the basic requirements of a secure hash function.

  • Fixed length: whether the input is a single character or a huge video file, the length of the output hash value is always constant. With SHA-256, for instance, any input becomes 256 bits (64 hexadecimal characters).
  • One-way: computing a hash value from data is easy, but reverse-calculating the original data from a hash value is practically impossible. This "cannot be reversed" property underpins the security of password storage and more.
  • Avalanche effect: changing the input even slightly changes the output hash value greatly. A single character, or even one space, results in a completely different value.

In addition, a good hash function must make collisions hard to occur. A collision is when two different pieces of data happen to produce the same hash value. As discussed later, being collision-resistant is what justifies "guaranteeing the identity of data."

Same input → always the same output / Even slightly different input → completely different output

Differences Between MD5, SHA-1, and SHA-256

There are many kinds (algorithms) of hash functions. Let us compare three representative ones.

AlgorithmOutput lengthCurrent security
MD5128 bits (32 chars)Collisions found. Not recommended where security matters
SHA-1160 bits (40 chars)Collisions demonstrated. Not recommended for signatures and other critical uses
SHA-256256 bits (64 chars)Widely used today and considered secure

MD5 is a fast algorithm used since long ago, but it is known that you can intentionally create the same hash value from different data (a collision attack), so it is unsuitable for tamper detection or security uses. That said, it is still used in scenarios that assume no malice, such as a simple corruption check for transmission errors.

SHA-1 was also widely used, but in 2017 it was demonstrated that collisions could be produced at a realistic cost, and it is being retired from critical uses such as digital signatures and certificates.

SHA-256 is one of the SHA-2 family and is the most standard hash function in use today. With a sufficient output length and no realistic way to find collisions with current computing power, it is adopted across a wide range of fields, from file tamper detection to blockchain. When choosing for a new use, SHA-256 (or the longer SHA-512) is the default.

To see how the hash value differs across algorithms, it is easiest to enter a string into the Hash Generator and compare. You can confirm on the spot that the same input produces completely different lengths and values depending on the algorithm.

What It Is Used For: Tamper Detection and Password Storage

There are two main representative uses for hash values.

1. Tamper detection and integrity verification

A software distributor sometimes publishes a hash value alongside the file. If a user computes the hash value of the downloaded file and it matches the published value, they can confirm that the file was not corrupted or tampered with along the way. Because the hash value changes greatly if even one bit differs, no slight alteration goes unnoticed.

2. Safe storage of passwords

Web services do not store user passwords as-is; they convert them into hash values and store those. That way, even if the database leaks, the one-way property means the original passwords are not immediately revealed. At login, the entered password is hashed the same way and compared with the stored value to authenticate.

However, simply hashing is not enough. Because the same password yields the same hash value, an attack that matches against lists of common passwords (rainbow tables) becomes possible. This is where a salt comes in. A salt is a random string added per password; mixing it in before hashing makes the same password produce a different hash value for each user. Furthermore, the current best practice is to use dedicated functions deliberately made slow (such as bcrypt or Argon2) for password storage, making brute-force attacks difficult.

How It Differs From Encryption

Hashing is often confused with "encryption," but their purpose and mechanism differ.

HashEncryption
DirectionOne-way (cannot reverse)Two-way (reversible with a key)
Output lengthAlways fixed lengthDepends on the original length
PurposeVerify identity / summarizeKeep content secret

Encryption transforms data into a form that third parties cannot read, and with the correct key it can be returned to the original (decrypted). It is for "hiding a secret and retrieving it later." Hashing, on the other hand, does not assume reversal. It is for confirming "is this data genuine" and "has it been tampered with." Storing passwords with a hash works precisely because "it cannot be reversed" leads to safety.

Collisions and Security

Because hash values are fixed length, there is an upper limit to the kinds of values they can represent. Inputs, on the other hand, can be created infinitely. Therefore, in theory, "collisions" where different inputs produce the same hash value always exist. What matters is whether that collision can be intentionally created within a realistic amount of time and cost.

For MD5 and SHA-1, methods to artificially create such collisions were found, so they can no longer be used where "guaranteeing identity" is the lifeline, such as tamper detection and signatures. SHA-256 is considered secure because creating a collision is not realistic with current computing power. Still, the assessment of cryptographic techniques changes over time, so it is important to choose the recommended algorithm according to the use.

Thanks to its fixed-length, one-way, and avalanche-effect properties, the hash value is a foundational technology active in everything from file integrity checks to password protection. Start by computing hash values for various strings in the Hash Generator, and feel how much the value changes when you slightly alter the input. Confirming the mechanism with your own eyes is the shortcut to understanding.

Please note that this article is intended to provide general information. When implementing password storage or tamper detection in an actual system, consult the latest official documentation and security professionals, and choose a method suited to your use.

FAQ

What is a hash value?

A hash value is a fixed-length, short value obtained by passing data (a string or file) through a hash function. The same input always produces the same value, and even a one-character difference changes the value greatly. It is used as a summary or "fingerprint" of data, for tamper detection, password storage, and more.

Can you recover the original data from a hash value?

No. A hash function has a one-way property: computing a hash value from data is easy, but reverse-calculating the original data from a hash value is practically impossible. This "cannot be reversed" property is why passwords can be stored safely.

How do MD5, SHA-1, and SHA-256 differ?

The main differences are output length and security. MD5 is 128 bits, SHA-1 is 160 bits, and SHA-256 is 256 bits. MD5 and SHA-1 are known to allow intentional collisions and are not recommended for security-sensitive uses such as tamper detection or signatures. SHA-256 is the default choice for new uses.

Are hashing and encryption the same thing?

No. Encryption is a two-way technique that can be reversed with a key and is used to keep content secret. Hashing is a one-way technique that cannot be reversed and is used to verify the identity of data or to summarize it. A major difference is that a hash output is always fixed length.

Is the data I enter into the hash generator sent anywhere?

WAZA TOOLS' Hash Generator runs entirely in your browser. The strings or data you enter are never sent to or stored on a server, so you can compute hash values confidently even with sensitive text.