# A Simple Introduction to One-Way Functions

## A Simple Introduction to One-Way Functions

This is the first article of the series that I have planned to write explaining the Cryptography behindBlockchain.

In this article, I will be covering **One-Way Functions.**

To understand the need for one-way functions, let me first help you understand **Two-Way functions.**

### Two-Way Functions

Let us assume that we have a function f(x)=y. Whenever we give input as “x”, we get an output “y”.

Now let us look at the following table:

If we observe the above Input and Output values, by close observation we find that output is always the square of the input, i.e y=x*x. Or f(x)=x*x.

Now, let us say that the function generates an output as “121”. Since I know the function, I can easily tell that the input would have been “11”. Functions wherein we can determine the input with the help of its output are known as **Two-way functions** .

As much as we have enjoyed cracking this function we should realize that if we incorporate them in the Systems or Application Design, any hacker with can crack open the application with a simple **brute force attack** .

This particular **vulnerability** of Two-way functions led to the adoption of One-way functions.

### One-Way Functions

Let us consider the SHA256 of the following numbers.

SHA256(1) = 6B86B273FF34FCE19D6B804EFF5A3F5747ADA4EAA22F1D49C01E52DDB7875B4B

SHA256(2) = D4735E3A265E16EEE03F59718B9B5D03019C07D8B6C51F90DA3A666EEC13AB35

SHA256(3) = 4E07408562BEDB8B60CE05C1DECFE3AD16B72230967DE01F640B7E4729B49FCE

If you observe the above three output, they do not follow a pattern. Thus, there is no way we can identify the input of the function. When these functions are used in applications, it is **not an easy task** for a hacker to penetrate into the application. Such functions are known as **One-Way Functions.**

In the upcoming articles of this series, I will be explaining **Hashing Algorithms** and how they are incorporated in **Blockchain Design** . Stay tuned for the updates! Thank you for reading my article.

- 委内瑞拉军方遭受Machete组织攻击
- 基于AES和RSA来保护数据
- oss对象存储大批量迁移工具-qscamel
- 追踪Aurora（欧若拉）勒索病毒，Emsisoft更新解密工具
- 原创雪球回应“12万人数据被泄露”：该网传图片为不实信息
- Visualizing Soccer with StatsBomb Data and R, Part 1: Simple xG and Pass Partner Plots!
- 对某攻击队的Webshell进行分析
- 网络协议 -- CA证书签署
- 16个通用高效 Java 工具类总结
- 等保2.0标准个人解读（二）：安全通信网络