What is Cryptographic Hash Function?

Back to Glossary

A cryptographic hash function is an algorithm that converts an input string of any length into a fixed-length output known as a hash.

The largest cryptocurrency by market cap, Bitcoin’s blockchain leverages this hashing process by passing a block of transactions as input through a cryptographic hash function that generates an output hash before being chained to a previous block.

There are several popular hash functions such as MD5 Hash, SHA-1 Hash, SHA-256, etc. Bitcoin uses the SHA-256 hashing algorithm(Secure Hash Algorithm) to produce hash values and protects the network against brute force attacks.

Hashing vs Encryption Aren’t They the Same?

Although they share many similarities, hashing and encryption differ in their purposes and processes.

Encryption is a two-way function used to conceal sensitive data that can only be revealed using an accompanied decryption key. This does not mean the data cannot be accessed without providing the decryption; instead, the decryption key alone makes the data readable as the encryption process scrambles the message.

On the other hand, hashing is a one-way function. This means that once data is passed through a hashing algorithm, it is near impossible to derive its original input from its output, and no two inputs can produce the same output (hash).

Although both processes protect the integrity of messages,  encrypted data is executed to be revealed later while a hash, in reality, cannot be used to derive its original input as it requires ridiculous amounts of computing power.