Hash function

From Decimal Wiki
(Redirected from Hash)
Jump to navigation Jump to search

Hash function is a mathematical transformation of information into a short string of a certain length.

The logic of this process is as follows: you enter something long, and the output turns out to be something short, personifying that long.

In the case of cryptographic hash functions, the "input" is not necessarily long. It can be something very short, for example, the word "bit", or very long, for example, the entire text of the DecimalChain Yellow Paper, and at the output you will get a unique string of the set length.

In addition, unlike simple "abbreviators"' of links, hash functions in cryptocurrencies act only in one direction. Despite the fact that the same data will always give the same hash, it is impossible to reproduce the original information from the hash obtained from them.

The concept of hashing means an unambiguous and precisely known calculation of a set of fixed-length characters based on input data of arbitrary length. At the same time, changing at least one character in the source data guarantees that the resulting fixed string will be different. We can say that hashing is "fingerprinting" a large set of data.

Hash function analysis is often used to monitor the integrity of important operating system files, programs, and data. Monitoring can be carried out both as necessary and on a regular basis.

First, they determine the integrity of which files need to be monitored. For each file, its hash value is calculated using a special algorithm with the result saved. After the necessary time, a similar calculation is made and the results are compared. If the values are different, it means that the information contained in the file has been changed.

Let's look at an example: you downloaded a large file (let's say a zip archive) and want to make sure that there are no errors in it. You can find out the "hash amount" (the same fingerprint) of this file and compare it with the one published on the site. If the hash sum strings differ, then the file is definitely "broken".

How Cryptographic Hash Functions work

There are different types of cryptographic hash functions, and each of them works differently.

The SHA-256 hash function used in DecimalChain (bitcoin and many other blockchains) works based on a formula related to the reflection of light from ellipses. You shouldn't worry too much if you don't understand something. The bottom line is that cryptographic hash functions are practically magic, and if you are not a mathematician, you will never fully understand them.

How hash functions are applied in DecimalChain

In order for the blockchain to work, it must be updated and keep up-to-date records of all transactions and coins available to each participant of the network. It is when updating transactional information that any authenticating system is vulnerable to attack. The Bank mitigates this risk by having a strict centralized hierarchy that guarantees authenticity at its own risk. The DecimalChain blockchain manages to be updated while remaining decentralized, as it uses a cryptographic probabilistic hash "game" called Delegated Proof-of-Stake.

This ensures consensus, and also prevents attacks aimed at manipulating the system. Thus, cryptography makes blockchains more secure than any bank with human verification.

Hash pointer

The blockchain is a linked list containing data and a hashing pointer to the previous block, creating a connected chain.

The hash pointer is similar to the usual one, but instead of just containing the address of the previous block, it includes a hash of the data inside the previous block. It is this small setup that makes the blockchain so reliable.

Imagine that a hacker attacks block 9 and tries to make adjustments to the data. Because of the properties of hash functions, even a small change greatly transforms the hash. This means that any minor corrections made in block 9 will change the hash stored in block 8, which in turn will change the data and hash of block 2, and this will lead to changes in block 1 and so on. The chain will be completely changed, and this is impossible.