# CryptoCurrency Fundamentals : Hash Function

0
23

### CryptoCurrency Fundamentals : Hash Function

This is the first article in the series of fundamentals on CryptoCurrencies and BlockChains. I will try my best to present exemplary visualizations and give examples in layman terms.

Simplicity is the ultimate sophistication.

### What the heck is a Hash Function ?

Think of a couple of cities that you have been to and the moment you think about them some hazy visuals pop of different locations pop up in your mind. That is a mapping that our brain has stored for that city.

Imagine a child identifying the colours of different fruits — Red for Apple, Orange for Orange, Yellow for Banana. That is a Colour⇒ Fruit map the child has created in its brain.

Hash function is a mathematical function that maps an input set of elements to an output set of elements. The catch is that the output space is pretty arbitrary, given an output it is really hard to guess what the corresponding input was.

Think you would be able to get from the city name to hazy visuals in your head but if somehow someone sneakily got hold of these hazy visuals they won’t be able to tell what city it is.

It is like a Trapdoor, you can get in easily but its hard to come out.

SHA-512 is a Hash Function that maps any input string to a 64 characters long string in hexadecimal base.

#### What is a Hexadecimal base ?

We work in decimal system which is in base 10 and the Hexadecimal system is base 16, more here.

Let us see take two input string “blockchain” and “blockchains” and see how uncorrelated their outputs are. We will take the first 6 characters of the SHA-512 hash output to depict the hexadecimal colour code in RGB scheme.

Note: the first two characters in the output are 0x that is a symbol for the following string to be in hexadecimal.

You can pretty much hash anything including — text, contents of a file or an image. They are heavily used in storage systems and databases to track versions of data files and objects.

Outputs can be combined and sequentially hashed multiple times to make retrieving the starting values nearly impossible.