Blockchain Cryptography


Today we’re going to talk about the two key cryptographic features that maintain the integrity of all blockchains; cryptographic hash functions and digital signatures. Before we get into this topic allow us to clarify one thing. You do not have to know how these cryptographic features work to purchase, store and/or use cryptocurrencies. Most users have little to no understanding of the underlying technology that protects the integrity of blockchains. If the technical aspects of blockchain doesn’t interest you, feel free to skip this post.

The main benefit of understanding blockchain cryptography is that you will develop a more complete understanding of how blockchains works and will be better able to communicate it to friends and family who will undoubtfully have tons of questions. Also, it’s a super awesome technology!

Hash Functions

Before we begin let me introduce you to the guy who makes all of this possible.

While their exact origin is debated, hash functions started to gain traction back in the 1960’s when researchers realized their potential in the budding field of computing. A hash function is a type of function that returns a string of characters of a fixed size from a dataset of an arbitrary size. Cryptographic hash functions are hash functions that have some application in cryptography and have some unique properties that make them extremely useful:

  1.   They are deterministic. That is, the same input always produces the same output.
  2.   Small changes in the input results in a dramatic changes in the output.
  3.   They are quick to compute.
  4.   They are “one-way functions”. That is, it is extremely difficult to determine an input if you are given the output.

SHA (Secure Hash Algorithm) is a family of hash functions published by the US National Institute of Standards and Technology. Most blockchains use either SHA or similar cryptographic hash functions to secure the flow of information. Bitcoin uses SHA-256. You can check out how SHA-256 works and play with this hash function on this website. We highly recommend you try this out for a few minutes as it will make the next section a lot easier to follow.

Cryptography and Passwords

To understand one of the key use cases of hash functions, lets start with a simple example. Lets say 2017 Average Jane and Joe are both members of a secret cult and the only way to prove their membership to each other is by stating a secret password.

Jane could check if Joe is a member of the secret cult by asking him to state the password but there’s a problem with this; Joe doesn’t want to give away the password since he has no way of knowing if Jane is a member or not!

The solution to their problem is a hash function like SHA-256. Lets say the actual password is:

“Support the creators of this blog if you find their content educational”

To prove their secret cult membership to each other, Jane and Joe could both insert the passphrase into the hash function (try it out for yourself) and compare the resulting hash: