One Waffle with a Side of Cryptographic Hash — Smothered, Covered, Chunked and Diced. Please :)

Introducing Cryptographic Hash Functions — Post #14

Michael Kerbleski
3 min readOct 15, 2017

A hash function is a series of mathematical functions that transform an input into an output. Two key elements of a hash function are:

  • They are repeatable.
  • They output a fixed length.

Let’s run through a very simple example.

Pretend I have a castle with high security. I want to remember a simple password, “Dog”, but I don’t want anyone who is guarding the castle to hear this easy to remember password.

If our hash function was “divide by two”. First, we would convert letters to numbers, so “Dog” = 4, 15, 7 (“D” is 4th letter in the alphabet, “o” is 15th letter, “g” is 7th letter). Divided by 2 the password would be 2, 7.5, 3.5.

Now instead of memorizing “2, 7.5, 3.5" you can memorize the password “Dog” and use the function to get to your password. The guards can store the password as a hash of the input. When you return to enter the castle you can type in “Dog” to the cryptographic machine (cause it is a high tech castle) and the guards will verify the hash of this password, instead of the password itself.

This way, you are the only person who knows the password and can produce the unique hash. Not even the guards know your password, but they can verify that you know the password.

The hash function becomes cryptographic when:

  1. It is non-reversible — You can transform “Dog” into a hash but it is impossible to transform the hash back to “Dog”.
  2. It is collision-free — It is impossible to generate the same output from two different inputs.

Below I have included an example of a hash function from Wikipedia. Note in the image below that when the word “over” changes slightly it causes a very different output. Also, note how all outputs or “digests” are the same length.

By User: Jorge Stolfi based on Image: Hash_function.svg by Helix84 — Original work for Wikipedia, Public Domain, https://commons.wikimedia.org/w/index.php?curid=5290240

Passwords are one example of using hash functions. In later posts I will explain how the bitcoin protocol uses cryptographic hash functions, to secure the network.

Vocabulary:

Hash: The output of a mathematical function performed on an input.

Cryptographic Hash: A one-way mathematical function where the output can be calculated from the input, but the input cannot be calculated from the output.

This is post #14. The others are located here.

Want to be emailed these posts (or weekly/monthly summaries)? Sign up here.

Any comments, suggestions for improvement, or topic requests? Get in touch or email me at miketalksaboutbitcoin@gmail.com

--

--