The Hash

Eat Your Hash!

SHA-256 function via Crypto.js

Note: Please configure your browser settings to access the API, or the simulation won't work.


Before anything, we need to talk about the hash. And we're going to do this in a very visual way, and make it easy to understand. A hash is essentially a bunch of random numbers that works like a fingerprint for any digital content. You can make it as long or as short as you want - but if it's too short, then you can't represent too many different types of content.


Conceptually, it's really simple: take any digital content, and transform it into a unique set of digits and/or letters.


Obviously we're going to need an algorithm for this, called a hashing function. In blockchain technology, one particular hashing function is the SHA-256 hash. Let's see how it works. Below, I've coded a simple block where you can key in anything into the "Data" section - this represents the digital content you want a fingerprint for. Depending on what is keyed into the "Data" section, the hash changes accordingly.


Illustrating the SHA-256: key in data, watch the hash run!


So the hash you see here is a fingerprint for anything I type in the "Data" section. It changes each time I type something inside. When the "Data" section is blank, there is a hash value well. In fact, you could put the National Anthem of Singapore inside this, and get a hash to represent it.


And no matter how many times you write exactly the same data, the hash is going to remain the same. In the next section, we will extend this idea of a hash to a "block of data".