# How to Create a Hashing Algorithm using Ethereum

How to Create a Hashing Algorithm using Ethereum

### What is Hashing?

Hashing is a concept that has its origin in software engineering that is now used in cryptography to secure or encrypt confidential information. This term is used to create hashing algorithms such as Ethash, SHA-256, Cryptonight, X11, and Scrypt.

Practically, a hash is a fixed-length alphanumeric string that can be used to uniquely identify a text (e.g. a message, a program code, a name, etc.). Algorithms are used to compute a hash.

There are many hashing algorithms. To help you understand the concept better, I’ll create a dummy hashing algorithm to explain this concept later.

When a cryptocurrency holder initiates a transaction (sends payment), there are typically hundreds of thousands of miners competing to validate the transaction.

The miner’s computer attempts to solve the mathematical puzzle through a process known as hashing.

The higher the hashing power, the higher the chances of guessing or solving the mathematical puzzle correctly.

The validation process is complete when a miner successfully adds the transaction and secures it to the blockchain network.

Before explaining hashing rate and how it is calculated, let’s see what happens behind the scene when a Bitcoin or altcoin is sent from one wallet to the another.

The miner earns a fraction of the mined token as a reward.

What differentiates one miner from another is the hashing rate or power.

### How to Determine Hashing Rate of a Miner

Hashing rate is the power a mining computer hardware requires to solve complex mathematical algorithms.

Hashing power is measured in gigahertz per second (GH/s). The higher the GH/s, the more algorithms it can solve per second.

This ability translates into the miner’s ability to mine more coins and earn more tokens in the process.

The example below from ASIC Miner Value shows different Ethereum & Bitcoin mining models, their hash rate, algorithm, and profitability.

Let’s see an example of the volume of transactions validated by Ethereum miners daily.

YCharts revealed that there were appropriately 1.716 million Ethereum transactions on May 10, 2021, and 1.183 million Ethereum transactions on June 11, 2021, which means that miners validated and earned a fraction from the value of those transactions.

To determine which of the computers will process the transaction, without being biased, all computers are open to compete and solve these huge volume, only a few will succeed.

Whoever completes the puzzle first gets the reward after the network confirms the miner’s proof of work.

### How to Create a Hashing Algorithm

My dummy hashing algorithm is going to create 4-character alpha-numeric character identifications for texts.

My hash algorithm is made up of the following steps:

— Step 1: Get the numeric value of each character in the text

— Step 2: Sum up the numeric values

— Step 3A: If the sum doesn’t have up to 8 digits, repeatedly append “0” to it until it becomes 8 digits in length

— Step 3B: If the sum has up to 8 digits, select the first 8 digits, and discard the rest

— Step 4: Change the sum into its hexadecimal form

— Step 5: Select the first 4 characters in the hexadecimal form

Example:

If we’re to use my algorithm, to compute the hash of the text “Ethereum”, this is how it will go:

— Step 1: Get the numeric value of each character in the text

Using the table below, the numeric values of the characters in this text are:

— 5 for “E”,

— 20 for “t”,

— 8 for “h”,

— 5 for “e”,

— 18 for “r”,

— 5 for “e”,

— 21 for “u”, and

— 13 for “m”.

— Step 2: Sum up the numeric values

5 + 20 + 8 + 5 + 18 + 5 + 21 + 13 = 95.

— Step 3A: If the sum doesn’t have up to 8 digits, append “0” to it until it becomes 8 digits in length

95 and “000000” gives “95000000”.

— Step 3B: If the sum has up to 8 digits, select the first 8 digits, and discard the rest

This step is not applicable since “95” is less than 8 digits in length.

— Step 4: Turn the sum into its hexadecimal form

The hexadecimal value of “95000000” is “5A995C0”.

— Step 5: Select the first 4 characters in the hexadecimal form

The first 4 character of “5A995C0” is “5A99”.

So, using my algorithm, the hash of “Ethereum” is “5A99”. Using SHA 256 (the hash algorithm used in Ethereum).

The hash of “Ethereum” is

“A13BEBEB57E1EA699BD4D2D9AC7E58399644E884B8A8783D96F6D146083F2430”.

### Hashing Puzzle

Ethereum typically gives out hashing puzzles that involve giving computers a text; the computers are expected to come up with a modification of that text that is —

• just a single character different from the given text; and
• has a hash that is smaller or equal to that of the given text.

For instance, you may be given a text like “Ethereum”, and you’ll be expected to come up with something like “Ethereum and “Ethereum” will be expected to have a hash value smaller or equal to

“A13BEBEB57E1EA699BD4D2D9AC7E58399644E884B8A8783D96F6D146083F2430”.

To win this type of puzzle, a computer will have to modify the given value continuously, until the hash value of the new modification meets the desired criteria.

The number of times a computer can modify the given text and check the hash of the modification, per second, is what is known as “hash rate” or “hash power”.

SEE ALSO: Trezor One and Trezor Model T Bitcoin Hardware Wallets – Which is Better?