# Cryptographic Hash Definition

## What is a Cryptographic Hash?

A hash function is a type of cryptographic algorithm. Instead of protecting the confidentiality of data — like encryption algorithms do — hash functions are commonly used to ensure data integrity, verifying that it wasn’t modified since creation.

## How Do Hash Functions Work?

A hash function is a mathematical function that takes inputs of any size and converts them to a fixed-sized output. For example, the popular hash function SHA-256 is named for the fact that it always produces a 256-bit output regardless of the input length.

In addition to these fixed-length outputs, hash functions have a few key features that make them useful for various purposes. These include:

**One-Way Function:**Hash functions are designed so that it’s possible to go from input to output but not backward. This prevents someone from determining the value used to produce a hash.**Collision Resistance:**A hash collision is two inputs that produce the same output. Hash functions are designed to make finding a hash collision infeasible. Once a collision is found for a hash function — or it seems possible to do so — the hash function is considered broken.

To achieve these goals, hash functions have other useful features. For example, hash functions are designed so that very similar inputs (differing even by one bit) produce very different outputs.

## Applications of Hash Functions

Hash functions are commonly used to ensure data integrity or to act as a secure representation of data. Some

**File Hashes:**Hash functions are commonly used to verify the integrity of files and other data. Since only a single bit change in the input creates dramatic changes in the output, even small changes to the data have major impacts.**Hash Tables:**Hash tables are used to organize data into buckets. Due to hash function collision resistance, it is unlikely that two pieces of data will be assigned to the same bucket if a secure hash function is used.**Password Storage:**Hash functions are deterministic, one-way functions, meaning that you can’t get the input from the output but the same input always produces the same output. This makes them ideal for password storage where a system can store and compare password hashes rather than saving a user’s real password to the system.**Blockchain:**Blockchain technology makes heavy use of hash functions. For example, hash functions are used to link the blocks in the blockchain together and are a crucial component of the Proof of Work (PoW) blockchain consensus algorithm.

Hash functions can be a good fit for applications where it isn’t necessary to restore the original data. Since hash functions are one-way functions, there is no way to “decrypt” a hash.

## Conclusion

Hash functions are cryptographic algorithms commonly used to ensure data integrity. They are designed to be one-way, collision resistant functions, meaning that it is infeasible to restore the original data or find two inputs that hash to the same value. This makes hash functions useful for error detection and integrity checking because any modifications to the input — accidental or intentional — will be easily detectable due to the resulting changes to the hash value.