A hash function in crypto plays an important role making public key cryptography secure at scale.

Hashing is used to create signatures during the transaction process and also to confirm transactions during the mining process (for proof-of-work).

A crypto hashing function in terms of transactions plays two basic roles:

The first is that it takes varying inputs (in terms of length and size) and packages those inputs into a specific and uniform size — almost like shipping containers on a cargo ship.

The second function is it provides each uniform container with a specific handle, which can’t be changed or altered during transit, ensuring the validity of its contents.

A crypto signature, along with a private key and a public key are used to encrypt and decrypt the hash on either side of the transaction.

These are some of the defining attributes of hash functions:

  • They are deterministic, which means the same output will always be produced by the same input
  • They are uniform (in terms of size of output) but also unpredictable so that outputs can not be pre-determined based on inputs
  • They are invertible or one way, meaning inputs are hashed into uniform outputs, but it’s not feasible to reverse-engineer an input based on an output.
  • They are collision-resistant, which means that unique inputs are designed to create unique outputs
  • All of the characteristics above result in the avalanche effect, which means that even the tiniest of changes or edits to an input will create an entirely new and completely different output

Hashing is also part of proof-of-work (POW) crypto mining.

Hashing is part of the process of sorting through data created by POW protocol software (called nonces) to find transaction hashes that fit the criteria for valid transactions.

Once transactions that meet the criteria are identified they are broadcast to the rest of the network, where they are confirmed by other nodes.

It’s through this process — and the use of hashing — that transactions can eventually be settled and become part of a public, decentralized, and immutable public ledger.

Hash function