What is hashing?

By Anycoin Direct

In this lesson, we are going to talk about hashing. It's certainly not easy, but we won't let that scare us away. Here we go.

Brief summary

✔️ Hashing is converting a collection of data into a code, the hash, using a predetermined calculation.

✔️ Hashing is often used to secure passwords so that only the user can read them and to compare checksums when downloading files.

✔️ Digital signatures use hashing for authentication, requiring the recipient's private key to decrypt the message.

✔️ Cryptocurrencies use hashing for mining, in which computers must use their computing power to solve puzzles to receive rewards.

Hashing

Definition:

Hashing is the process by which a collection of data is converted by a function into a code, the hash. What are you saying?

So first, let's explain what a hash is. A hash is an outcome of some kind of calculation based on predetermined conditions. A hash consists of a series of numbers and letters.

Example of hashing

We will give an example of hashing, to make it a little more visual. SHA (Secure Hashing Algorithm) 256 allows you to obtain a hash for any kind of textual information. I will create two sentences that are very similar, but whose outcome (the hash) looks very different.

The phrase "what is hashing" (the input) produces the following hash:

a85eaf708bd0da1c0b7206ab8d69c30403b34be19588b71702d420ff9b21f09c (the output)

The phrase "What is hashing" produces a very different hash:

4bc6139ce79a8c6aeca74cd9397259fb54d4ea4fc7b930bb74404cfe94c34bcd

SHA-256 produces a 256-bit long hash (64 characters).

Hashing direction and security

By the way, hashes work in one direction. You can create the hash of a sentence, but you cannot reconstruct a sentence from the hash.

A hash must be set up so that it requires unacceptable effort to guess the hash based on brute force (simply checking all possibilities 1 by 1). The more characters a hash function generates, the harder an input is to crack.

Now the idea of hashing must have taken shape in your imagination.

What is hashing used for?

Nice, such a jar of hashing. But what can you actually do with it?

In general, we can say that hashing is used to secure data. Most commonly, it is used in IT to secure passwords.

Password hashing

Suppose you make up a password and have to send it over the Internet by entering it somewhere. If it is sent in plain text without encryption or hash, hackers can read what you enter there. That's why passwords today are converted into a hash so that only the user can read what they enter.

File hashing

Hashing can also be used when downloading files. You first calculate the hash of the file before downloading it, then see if the so-called checksum is the same. If both values are the same then the file is the original. Very handy if you don't want viruses or Trojan horses passing through the ports.

Hashing and cryptography

A well-known phenomenon from the crypto world is the digital signature. Here you have a sender and a receiver. A hash is made of a message. Without the private key, the message cannot be read. The receiver of the message then needs the secret key to decrypt the message. If the hash of the message matches the hash that can be calculated with this key then the message is the same as the original message.

In cryptocurrency, they work with the private key and the public key to display your address (public) or determine whether you can spend this amount of money (private key).

Commercial hashing

It is also used for personal data. When you order things online from a store you first create an account. Most of your data is hashed, so you can order anonymously, but delivery can be made to your address.

Hashing can be further secured by techniques called salt and pepper. Salt allows you to add a randomly generated number to the hash, which is then turned into a new hash, making it even more difficult for hackers to crack the code.

With pepper, you add the same string of 32 random characters to all records, virtually eliminating a brute force attack.

Bitcoin hashing

When mining Bitcoin, people often talk about the hashrate. You may now be able to guess what the meaning of this is.

A computer's hashrate is the computing power it possesses to perform a difficult cryptographic puzzle to solve. This difficult puzzle is to guess the input of a hash. Whoever guesses it first gets to add a new block to the blockchain and gets the reward in the form of transaction fees and new Bitcoins.

The hashrate of the Bitcoin network is the total computing power of all computers mining Bitcoin. As it gets higher, the puzzle must get harder. The fact is, a new block must be found about every ten minutes according to Satoshi Nakamoto. If computing power goes down, say if many miners quit, then the puzzle has to get easier, otherwise those ten minutes soon become 11 or 12 minutes and throw a spanner in the works.

Components of a Bitcoin block

When a new block is created in Bitcoin, it has a number of sections. Each block contains a hash of the previous block. This is to ensure that all blocks are stored sequentially.

Next you encounter the tx_root, which is the root hash value of the Merkle tree that contains all transactions. A Merkle tree could be thought of as a collection of hashes. It is a tree diagram, where all transactions are given a hash and merged together until only one record remains with all transactions (hashes) in a single hash, the Merkle root or also called root hash. With this method, a block is much less populated than if you had to write all transactions into it, and this promotes speed.

This is followed by the timestamp. This contains the time when the block was created. Thus, you can only create blocks forward in time.

Then comes the nonce. This is a hash that the miner must guess in order to be allowed to mine a new block.

The future of hashing

In cryptocurrency, hashing is used because it works so well and fast. Hashing also contributes significantly to security because it is a one way system. You can generate a hash very easily, but to guess the input from the hash is virtually impossible.

Since hashing is essential for security, it will be deployed for a long time to come. Although with the advent of quantum computers, a new trick will have to be invented.

Test your knowledge

Question: 1/5What do you call that which you want to convert into a hash?
AInput
BOutput
CInfo
DCryptographic