One Way Functions - UNDERSTANDING THE BLOCKCHAIN; Episode 10

in Project HOPE4 years ago

Hey there! Welcome to another episode of Understanding the Blockchain.

You can check out previous episodes here:

1. Episode 1 | This Is How Money Works

2. Episode 2 | Is Digital Money the Answer?

3. Episode 3 | Before Bitcoin, Earlier Attempts at Crypto

4. Episode 4 | Finally, Bitcoin!

5. Episode 5 | How is Crypto Acquired?

6. Episode 6 | A Bitcoin Transaction in Depth

7. Episode 7 | An Overview of Mining

8. Episode 8 | An Overview of Mining

9. Episode 9 | Introduction to Cryptography | Earlier Attempts at Cryptography



One-Way Functions
Pixabay | Photographer: RyanMcGuire


Hey guys, in today’s episode of the series, we’ll talk about one-way functions. This is the very first place we’ll have to start from to understand Cryptography. It is one of the most important building blocks of cryptography.

We’ll briefly explain one-way functions in this episode and build upon it in later episodes to see how it relates to the blockchain technology.


First, what is a function?

A function basically takes a set of inputs and relates it to set of outputs.
So, if this was algebra, imagine x2 as a function. If you feed in an input like 3 for example into the function x2 and you get an output of 9.

Function =  x^2
Input =     3
==>         3^2
Output =    9   

So, an input of 4 would yield 16, and input of 5 would yield 25 and so on. So that is the idea of a function. You feed in an input which gets processed by the function and you get an output.


What then is a one-way function?

Wikipedia defines a one-way function as

a function that is easy to compute on every input, but hard to invert given the image of a random input.

Let's break that down.
Imagine we try to work our way backwards from the x^2 function we have. We have 9 as an output and we try to find out what the input is.

Instead of 32 = ?,
We have (?)2 = 9.

We can run some math on this function and know the value of x is 3. This is not a one-way function.

Now let’s explore another function. This function takes different emojis and states which color they are.

color(😀) = ?
color(😀) = yellow

color(😆) = ?
color(😆) = yellow

color(😡) = ?
color(😡) = red

Now what if we want to try working back from these functions?

color(?) = yellow

How do we find out which emoji is supposed to fit into that function? There is no math to solve this. You simply can’t determine which exact emoji is supposed to be in the function because there are over a hundred emojis all with the color yellow.

This is a ONE-WAY function.

This is a unique property of one-way functions. You can’t determine the input from the output; you can only determine the output from the input.

More examples of one-way functions. This function simply determines if the input is even or not and outputs ‘Yes’ or ‘No’.

isEven(x) = ?
isEven(5) = No
isEven(8) = Yes

This function cannot work backwards because an output of ‘No’ can’t be used to determine the correct input since there is an infinite possibility of number that can be odd.

So, isEven(?) = 'No' simply won’t work.

In conclusion, a one-way function is a special function which you cannot work backwards from.


Up Next

This is a really important concept in cryptography and in the next episode when we talk about how it relates to bitcoin and the blockchain, it’ll make more sense.


hr.png

You can check out My Blog for more amazing content.