# Algorithms: Non-Technical Guide

## Introduction

There is no arguing the fact that one of the most important things for crypto traders and investors is to see their investment increase in value. The basic rule of buying low and selling high still applies and very few people bothered about technical details or core concepts of the blockchain. In this guide, we will break down one of the overlooked and less discussed subjects in the cryptocurrency space – algorithms.

Understanding how cryptocurrency hashing algorithms work will help you better understand blockchain tech as a whole, and stay ahead of most crypto enthusiasts. You would also be able to identify some of the core mechanics of any cryptocurrency project. After all, expanding your knowledge wouldn’t hurt. This article will explore concepts like algorithms, hashing functions, and the common ones used in the cryptocurrency space.

Let’s dive straight in.

## Basic Terms

According to Techopedia:

“An algorithm is a step-by-step method of solving a problem. It is commonly used for data processing, calculation, and other related computer and mathematical operations. An algorithm is also used to manipulate data in various ways, such as inserting a new data item, searching for a particular item or sorting an item.”

You can think of an algorithm like a recipe book. Typically, you will have a list of required ingredients and a step-by-step guide on how to bake a cake for example – what to add, when, and at what temperature. If you follow the manual, you are surely going to make a good cake.

A more technical definition of algorithms will be a series of detailed instructions for solving a problem. For example, there can be an algorithm to calculate when and how much an employee should be paid at the end of the month. To get this done, data needs to be fed into the system. These may include details such as the employee’s basic salary, how many hours he worked each day in one month, when he resumed work, overtime, amongst others. The bottom line is that computer algorithms can solve problems with more efficiency than their human counterparts.

So how does this relate to cryptocurrencies?

## Hashing

Blockchain and cryptocurrencies, in general, have been touted for the secured nature of transactions. It’s impossible for anyone to have access to your account unless he or she knows your private and public keys. In addition to this, if you have ever tried selling online, then you’d agree that some customers may become rather funny with chargebacks. Blockchain transactions have been designed to be immutable and non-reversible once confirmed.

Imagine you are trying to send an essential document to someone in another state, and you want this document to get to this person in one piece – no changes whatsoever. Although there are many ways to ensure that this happens, such as sending multiple copies of the document at intervals or contacting the recipient to verify the authenticity, amongst others, using a hashing algorithm will be the best bet here.

The goal is to generate a secure hash. That is a value compiled from a base input using a hashing function. The result from this process is a long string of numbers and symbols, that is unique for the content processed.

Let’s take a simple example:

**Input Number:** 50,679

Imagine that our input number is the code to a lock and anybody that has this code can access all our life savings or more appropriately all our Bitcoins.

To hash this input number, let’s choose a multiplier of 121. Our algorithm will look something like this:

Input Number * 121

**Hashing Value:** 6,132,159

From the example above, it is obvious that deciphering how the value 6,132,159 came about is almost impossible. It only becomes easy if you know the multiplier 121. This is the basic idea of hashing algorithms; real-life cases of public-key encryption are more complex. They generally use larger hash values for encrypting, and you may have 40-bit and even 128-bit numbers.

A 128-bit number for example has a possible combination of 2128. To help you understand how secured this is, 2128 is equivalent to 3,402,823,669,209,384,634,633,746,074,300,000,000,000-000,000,000,000,000,000,000,000,000 combinations. This is like trying to find a grain of sand in the Sahara Desert.

Before we proceed to look at how cryptographic hash functions work, let’s have a broad overview of what hashing is:

Bonus Tip:The hash code created by a hashing algorithm is called a “message fingerprint” or “message digest.”

Hashing is a cryptographic process used to convert any form of data into a unique string of text. Virtually any kind of data can be hashed, no matter the size or type. Hashes have been designed to act as a one-way function. What this means is that you can put in data into the hashing algorithm and get a unique set of symbols, but you cannot determine the original message from the result.

Like in our example above, our hashing algorithm remains: Input Number * 121. Changing the input number will change the hashing value. A unique set of input data will always produce the same hash.

In the context of blockchain and cryptocurrencies, each transaction is taken as an input value and run through a hashing algorithm (such as SHA-256, Scrypt, MD5) that produces an output of fixed length.

### How Does It Work?

If you have read up until this point, then you’d be able to tell that hashing is a mathematical operation that is quite easy to perform. However, it is challenging to reverse. While encryption can be reversed or decrypted using a specific key, hashing is one way. Some of the most commonly used hashing algorithms include MD5, SHA1, and SHA-256.

Bonus Tip:You may have been involved in hashing without even knowing. There is every possibility that you have an email account or a social media account on Facebook or Twitter. Now for every time you need to log in, you have to input your password. What if I told you that most platforms do not save your password as it is. Instead, they run your password through a hashing algorithm and save the output hash of your password. So, for every time you try to log in, the platform runs your password through their hashing algorithm and then compares the output with what they already have saved in their database. You are granted access only when both hashes match.

## Hashing in Cryptocurrencies

Using Bitcoin blockchain as an example, “mining” is done by performing a series of hashing functions (in this case SHA-256 algorithm). It is used to write new transactions, their timestamp, and add a reference to them in the previous block. A combination of several blocks is what is then known as the blockchain. When a new block of transactions is added to the chain, a consensus has to be reached among the operators of several nodes. These nodes validate and verify that the transactions are right and true. It is almost impossible to reverse a transfer once the nodes in a network confirm it is true. Trying to do so requires enormous computing power, and this will alter the one-way nature of hashing.

Now that we know what an algorithm is, and how hashing works concerning cryptocurrencies, let’s proceed to examine some of the standard hashing algorithms in the cryptocurrency space.

## Cryptocurrency Hashing Algorithms

Cryptocurrencies make use of different algorithms, otherwise known as hashing functions. We have already explained that a hash is a message digest. Some of the common cryptocurrency hashing algorithms include SHA-256, Ethash, Scrypt, Equihash, Cryptonight, and X11, amongst others. Let’s have a look.

### SHA-256

SHA-256 which means “Secure Hash Algorithm 256” is one of the most popular hashing algorithms because of Bitcoin. If you have ever done some essential reading on Bitcoin or ever tried to mine it before, you may have come across this term. With regards to Bitcoin, this algorithm is used during the creation of a public key from a private key. It is also used during the realization of the process of proof of work. It belongs to the SHA-2 family and a 256-bit (32 bytes) signature is generated for a text string.

It is worth noting that hashing algorithms are not specific to only cryptocurrencies. As with Bitcoin, there have been attempts to decentralize payment systems in the past. Bitcoin is only famous because it was the first successful attempt at this concept. Similarly, a hashing algorithm is not a new concept and is being applied in several other industries. So, your understanding of algorithms concerning cryptos (from this guide), is universal and can be applied to other fields. With this said, the SHA-256 algorithm was created by the United States National Security Agency (NSA) in 2001 and is being used by governments and financial institutions to encrypt data.

If you’ve been following Bitcoin mining for some time, you may be tempted to say that mining of Bitcoin is not profitable. Several news sites and so-called experts have come up to support these claims and here’s their reason. During the early days of Bitcoin, miners could validate transactions and mine Bitcoins using regular CPUs (computer processing units). However, they soon discovered that GPUs (graphics processing units) could do a better job. Presently, none of the above options can generate a substantial amount of Bitcoin. What is on the market are “Application Specific Integrated Circuits” ASIC, with the single function of mining one coin – in this case Bitcoin. If as a miner you decide to use your CPU or GPU to mine, you will be wasting your time and money on electricity.

The block processing time for this algorithm is around ten minutes. The required hash rate is measured in Giga hashes per second (GH/s). Some other cryptocurrencies other than Bitcoin that used this algorithm include Bytecoin, Devcoin, Joulecoin, Battlecoin, Peercoin, and Betacoin, amongst others.

### ETHASH

As the name suggests, Ethash is Ethereum’s proof of work (PoW) hashing algorithm. The interesting this about this algorithm is that it is GPU memory intensive. This idea is meant to discourage CPU mining and possible future development of ASICs. It utilizes Keccak, a cryptographic hash function that has eventually been standardized to SHA-3. Cryptocurrencies under this category include the popular Ethereum, its hard fork, Ethereum Classic, Expanse, KodakCoin, and Ubiq.

Ethash can discourage CPU mining while resisting ASIC mining by employing “Dagger-Hashimoto” spec.

Dagger was developed by the founder of Ethereum Vitalik Buterin and is intended to be an alternative to existing memory-intensive algorithms like Scrypt (which is discussed below). Algorithms in this category become hard to verify once their memory-hardness is increased to secure levels. This has made Dagger quite vulnerable.

Hashimoto was developed by Thaddeus Dryja and achieves ASIC-resistance by being IO-bound. What this means is that the memory of a device is used as the limiting factor in a mining process.

Ethash’s rate is measured by mega hashes per seconds (MH/s).

### SCRYPT

Scrypt is another PoW algorithm that is used by many cryptocurrencies. It was first tested and implemented for Tenebrix in 2011. Subsequent crypto projects that use this algorithm include Litecoin, Dogecoin, PotCoin, FeatherCoin, Ekrona, and TagCoin.

Scrypt is a simpler and faster alternative to SHA-256. If you’ve ever heard the founder of Litecoin, Charlie Lee, refer to Litecoin as being the silver of Bitcoin’s gold, then you now know its origin. According to him, Litecoin has been designed to be a faster alternative to Bitcoin.

Scrypt’s hash rate is measured by kilo hashes per second (KH/s).

In conclusion, there are other top mining algorithms like Equihash, Cryptonight, and X11.

Equihash, for example, allows individuals to mine cryptos using standard computers. Coins like ZCash, Komodo, Bitcoin Gold, and ZClassic all use the Equihash algorithm. Cryptonight, on the other hand, is still a PoW algorithm but can only be mined on CPU devices. Bytecoin, Monero, and Dashcoin make use of this algorithm.