## What Is a Hash?

A hash is a function that converts an input of letters and numbers into an encrypted output of a fixed length. A hash is created using an algorithm and is essential to blockchain management in cryptocurrency.

### Key Takeaways

- A hash is a function that meets the encrypted demands needed to solve for a blockchain computation.
- A hash, like a nonce or a solution, is the backbone of the blockchain network.
- Hashes are of a fixed length since it makes it nearly impossible to guess the length of the hash if someone was trying to crack the blockchain.
- A hash is developed based on the information present in the block header.

## How a Hash Works

The backbone of a cryptocurrency is the blockchain, which is a global ledger formed by linking together individual blocks of transaction data. The blockchain only contains validated transactions, which prevents fraudulent transactions and double spending of the currency. The resulting encrypted value is a series of numbers and letters that do not resemble the original data and is called a hash. Cryptocurrency mining involves working with this hash.

Hashing requires processing the data from a block through a mathematical function, which results in an output of a fixed length. Using a fixed-length output increases security since anyone trying to decrypt the hash won’t be able to tell how long or short the input is simply by looking at the length of the output.

Solving the hash is essentially solving a complex mathematical problem, and starts with the data available in the block header. Each block header contains a version number, a timestamp, the hash used in the previous block, the hash of the Merkle Root, the nonce, and the target hash.

The miner focuses on the nonce, a string of numbers. This number is appended to the hashed contents of the previous block, which is then itself hashed. If this new hash is less than or equal to the target hash, then it is accepted as the solution, the miner is given the reward, and the block is added to the blockchain.

The validation process for blockchain transactions relies on data being encrypted using algorithmic hashing.

Solving the hash requires the miner to determine which string to use as the nonce, which itself requires a significant amount of trial-and-error. This is because the nonce is a random string. It is highly unlikely that a miner will successfully come up with the correct nonce on the first try, meaning that the miner may potentially test a large number of nonce options before getting it right. The greater the difficulty—a measure of how hard it is to create a hash that meets the requirement of the target hash—the longer it is likely to take to generate a solution.

## An Example of a Hash

Hashing the word “hello” will produce an output that is the same length as the hash for “I am going to the store.” The function used to generate the hash is deterministic, meaning that it will produce the same result each time the same input is used. It can generate a hashed input efficiently, it makes determining the input difficult (leading to mining), and makes small changes to the input result in an unrecognizable, entirely different hash.

Processing the hash functions needed to encrypt new blocks requires substantial computer processing power, which can be costly. In order to entice individuals and companies, referred to as miners, to invest in the required technology, cryptocurrency networks reward them with both new cryptocurrency tokens and a transaction fee. Miners are compensated only if they are the first to create a hash that meets the requirements set forth in the target hash.