Bitcoin course for beginners 2 - 07/11

# What is hashing?

## LESSON CONTENT

Hashing is the process of converting any random number into another number using cryptography.

A hash function generates a new value using a **mathematical algorithm**. In **bitcoin **a **one-way algorithm** is used to encrypt data. In other words, in it impossible to reverse-engineer the calculation and the hash cannot be converted back. To **decrypt** it, a set of **public-private key** is necessary.

Hashing can be compared to a compression of data, but it is actually different. It seems that it operates very much like file compression because it takes a large amount of data and shrinks it in a much shorter string that the original. As an example, think of a library. If you input all the books of this library into a hash function and hash them, you will get a very short unique string which allows you to save a lot of memory space.

No matter how long the inputs are (*many books*), the output is of a fixed length (*256 bits length*). In th**e bitcoin blockchain**, the **transaction**, taken as input and run through the **SHA-256 algorithm **(*Secure Hashing Algorithm 256*), provide an output which has a fixed length (*256 bits*).

## Why a cryptographic hash function is secure? Because it has certain properties:

**1. It is deterministic: **

Remember that we said that you can’t reverse-engineer a hash because it is a one-way mathematical structure. But no matter how many times you run the hash function from beginning to end, you will always find the same result. It is great if you want to keep track of all the inputs in a system.

**2. Speed:**

The deterministic algorithm can return the hash of input very quickly which help the system to be more efficient.

**3. Shielded data: **

The one-way deterministic algorithm protects the original data. If someone makes even a small change in the input (let’s say a coma), the knock-on effect on the output will be huge. This mathematical “magic” leads to one of the ground-breaking novelties of the blockchain: its immutability.

## CHAPTER LESSONS

Lesson 1 – What is a cryptocurrency wallet?

Lesson 2 – What is cryptography?

Lesson 3 - Public Key - Private key pair

Lesson 5 - What is a distributed ledger?

Lesson 6 – How transactions work?

Lesson 8 – What is bitcoin mining?

Lesson 9 – What is proof-of-Work?

Lesson 10 – What is a consensus mechanism for cryptocurrencies?

Remember that if you subscribe, in addition to this course you will be able to access videos on the topics covered, quizzes and relevant readings and articles.

You will also have access to all the courses, and you will be able to enjoy all the premium content of BloqLeap Academy.