Encryption: Difference between revisions

From Decimal Wiki
Jump to navigation Jump to search
[unchecked revision][checked revision]
No edit summary
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{#seo:
                    |title= Шифрование в блокчейне
                    |titlemode= append
                    |keywords= Encryption in the blockchain
                    |description= Encryption in the blockchain
                    }}
<div class="mikio-article-content">
<div class="mikio-article-content">
 
<div class="mikio-tags">
<div class="mikio-tags">




</div>
</div>
<span id="shifrovanie_v_blokchejne"></span>
<span id="shifrovanie_v_blokchejne"></span>
= Шифрование в блокчейне =
= Encryption in the blockchain =
 
<div class="level1">
<div class="level1">
 
Блокчейн-технология воспринимается людьми как что-то сложное для понимания, но на самом деле основная идея проста. Чтобы разобраться с принципом работы блокчейна, давайте выясним, как с помощью криптографических алгоритмов шифруются данные.
Blockchain technology is perceived by people as something difficult to understand, but in fact the basic idea is simple. To understand the principle of the blockchain, let's find out how data is encrypted using cryptographic algorithms.
 
 
</div>
</div>
<span id="zachem_shifrovat_dannye_v_blokchejne"></span>
<span id="zachem_shifrovat_dannye_v_blokchejne"></span>
= Зачем шифровать данные в блокчейне =
= Why encrypt data in the blockchain =
 
<div class="level1">
<div class="level1">
 
Благодаря алгоритмам шифрования технология блокчейн считается самой безопасной разновидностью одноранговых сетей (Сеть где все равны между собой) . Для начала разберёмся, зачем в блокчейне что-то шифровать.
Thanks to encryption algorithms, blockchain technology is considered the most secure kind of peer-to-peer networks (a network where everyone is equal to each other). To begin with, let's figure out why to encrypt something in the blockchain.
 
В традиционных и понятных нам системах '''«клиент-сервер»''' за безопасность отвечает сервер компании, которая обеспечивает безопасность хранения денежных средств ( Сервер банка) Он выполняет следующие функции:
In the traditional and understandable systems "'client-server'"' the security is the responsibility of the company's server, which ensures the security of the storage of funds (the bank's Server), It performs the following functions:
 
1. '''Обеспечивает доступ пользователей к данным''' .<br />
1. '''Provides user access to data''' .<br />
Именно сервер хранит логины и пароли своих клиентов, проверяет пользователя, прежде чем дать ему доступ к сети.
It is the server that stores the logins and passwords of its clients, checks the user before giving him access to the network.
 
2. '''Следит за сохранностью данных''' .<br />
2. '''Monitors the safety of data''' .<br />
Сервер заботится о конфиденциальности данных пользователей и не даёт злоумышленникам доступ к личным данным и информации.
The server takes care of the confidentiality of user data and does not give attackers access to personal data and information.
 
3. '''Контролирует изменение данных''' .<br />
3. '''Controls data change''' .<br />
Любое изменение, прежде чем вступить в силу, согласуется с сервером. Таким образом поддерживается целостность данных.
Any change is agreed with the server before it takes effect. In this way, data integrity is maintained.
 
'''Так как в блокчейне каждый узел является и сервером, и клиентом одновременно, а центральный сервер отсутствует, для вышеперечисленных целей применяют криптографию.'''
'''Since each node in the blockchain is both a server and a client at the same time, and there is no central server, cryptography is used for the above purposes.'''
 
Криптографические алгоритмы шифрования выполняют вышеописанные функции без постороннего вмешательства и нам теперь не нужен сервер банка для безопасного хранения денежных средств. Также криптография отвечает на вопрос, какой использовать алгоритм шифрования для той или иной цели.
Cryptographic encryption algorithms perform the above functions without outside interference and now we do not need a bank server for safe storage of funds. Cryptography also answers the question of which encryption algorithm to use for a particular purpose.
 
 
</div>
</div>
<span id="algoritm_s_xesh-funkcijami"></span>
<span id="algoritm_s_xesh-funkcijami"></span>
= Алгоритм с хеш-функциями =
= Algorithm with hash functions =
 
<div class="level1">
<div class="level1">
 
Разработчикам блокчейна был необходим такой тип математических функций, которые '''легко шифрует информацию''' без возможности расшифровки, это односторонние функции.
Blockchain developers needed a type of mathematical functions that '''easily encrypts information''' without the possibility of decryption these are one-way functions.
 
Пример такой функции — умножение. Если мы знаем только ответ, то не можем однозначно сказать, какие два числа были умножены.
An example of such a function is multiplication. If we only know the answer, then we cannot say for sure which two numbers were multiplied.
 
Например, Х * У = 6
For example, X * Y = 6
 
Далее нужен такой тип односторонних функций, который '''превращает информацию произвольного размера в шифр определённой длины''' , и это хеш-функции. Они преобразуют сообщения в набор символов (хеши), которые можно удобно и безопасно использовать в программировании.
Next, we need a type of one-way functions that '''turns information of arbitrary size into a cipher of a certain length''', and these are hash functions. They convert messages into a set of characters (hashes) that can be conveniently and safely used in programming.
 
Такой набор символов (Хэш) может состоять как из букв, так и из цифр. Какие цифры и буквы будут в хеше, а также сколько их будет, зависит от выбранной хеш-функции.
Such a set of characters (Hash) can consist of both letters and numbers. Which numbers and letters will be in the hash, as well as how many of them there will be, depends on the hash function selected.
 
'''Рассмотрим подробнее наиболее известную — SHA-256, которая также используется в блокчейне DecimalChain''' .
'''Let's take a closer look at the most famous one — SHA-256, which is also used in the DecimalChain blockchain''' .
 
 
</div>
</div>
<span id="kak_rabotaet_xesh-funkcija_sha-256"></span>
<span id="kak_rabotaet_xesh-funkcija_sha-256"></span>
= Как работает хеш-функция SHA-256 =
= How the SHA-256 hash function works =
 
<div class="level1">
<div class="level1">
 
Хэш-функция SHA-256 используется и в блокчейне биткоина. SHA означает «безопасный алгоритм хеширования»‎, а число 256 — объём кеша в битах.
The SHA-256 hash function is also used in the bitcoin blockchain. SHA stands for "secure hashing algorithm", and the number 256 is the amount of cache in bits.
 
Работа хеш-функции SHA-256 концептуально напоминает создание отпечатков пальцев. Чтобы идентифицировать человека, не надо знать всю информацию о нём: достаточно знать отпечаток его пальца. '''SHA-256 вычисляет такой «отпечаток» у текстов, видео, изображений, музыки и других видов информации.'''
The operation of the SHA-256 hash function is conceptually similar to the creation of fingerprints. To identify a person, you do not need to know all the information about him: it is enough to know his fingerprint. "'SHA-256 calculates such a "fingerprint" of texts, videos, images, music and other types of information.'''
 
'''Алгоритм работы можно описать следующим образом:'''
'''The algorithm of operation can be described as follows:'''
 
<ol>
<ol>
<li><div class="li">
<li><div class="li">
 
На вход поступает сообщение файл размером до 2 млн терабайт.
A message arrives at the input a file up to 2 million terabytes in size.
 
</div></li>
</div></li>
<li><div class="li">
<li><div class="li">
 
Выполняются математические преобразования.
Mathematical transformations are performed.
 
</div></li>
</div></li>
<li><div class="li">
<li><div class="li">
 
На выходе получается хеш — 64-значное число.
The output is a hash a 64-digit number.
 
</div></li></ol>
</div></li></ol>
 
Закодировать текст и посмотреть, как работает хеш-функция, можно [http://crypt-online.ru/crypts/sha256/ онлайн тут]
You can encode the text and see how the hash function works [http://crypt-online.ru/crypts/sha256 / online here]
[[File:Commoninfo-sha256.png|1000px|class=mediacenter]]
[[File:Commoninfo-sha256.png|1000px|class=mediacenter]]
 
'''SHA-256 кодирует сообщения моментально''' . Хеши сильно отличаются даже при незначительном изменении в сообщении. Хеш меняется настолько, что абсолютно не имеет сходства между новым и старым значениями. Благодаря этому '''хеш-функция SHA-256 гарантирует невозможность изменения сообщения''' , не меняя хеша.  
'''SHA-256 encodes messages instantly''' . The hashes are very different even with a minor change in the message. The hash changes so much that it has absolutely no similarity between the new and old values. Thanks to this, "the SHA-256 hash function guarantees that it is impossible to change the message"' without changing the hash.  
 
Набор из букв и цифр в хеше — это одно 64-значное число, записанное в 16-ричной системе счисления. Чтобы найти два разных сообщения с одинаковым хешем, придётся перебирать их тысячелетиями, поэтому если два сообщения имеют одинаковый хеш, то будьте уверены: сообщения одинаковые.
A set of letters and numbers in a hash is a single 64—digit number written in a 16-digit number system. To find two different messages with the same hash, you will have to go through them for millennia, so if two messages have the same hash, then be sure: the messages are the same.
 
 
</div>
</div>
<span id="tranzakcii_v_blokchejne"></span>
<span id="tranzakcii_v_blokchejne"></span>
 
= Транзакции в блокчейне =
= Blockchain transactions =
 
<div class="level1">
<div class="level1">
 
'''Без хеш-функций существование блокчейна было бы невозможно''' .
'''Without hash functions, the existence of a blockchain would be impossible.'''
 
Блокчейн уникален тем, что гарантирует неизменность и анонимность данных, которые он хранит. благодаря алгоритмам шифрования. Любые данные перед внесением в блокчейн проверяются на подлинность, но при этом никто не может их увидеть. То же самое, что банкир проверяет подлинность банкнот, лежащих в закрытом сейфе. В этом и помогает хеш-функция.
The blockchain is unique in that it guarantees the immutability and anonymity of the data it stores. thanks to encryption algorithms. Any data is checked for authenticity before being entered into the blockchain, but no one can see it. The same thing as a banker checks the authenticity of banknotes lying in a closed safe. This is where the hash function helps.
 
Блокчейн регулярно обновляет данные, добавляя записи об изменениях «транзакции». При обновлении транзакционной информации любая система уязвима для атаки. Банки нивелируют этот риск с помощью централизованной архитектуры и одностороннего строгого контроля за правами доступа пользователей. '''У блокчейна нет централизованного органа контроля его заменяют криптографические хеш-функции''' .
The blockchain regularly updates the data by adding records of changes '''transactions'''. When updating transactional information, any system is vulnerable to attack. Banks mitigate this risk with the help of a centralized architecture and one-sided strict control over user access rights. '''The blockchain does not have a centralized control body it is replaced by cryptographic hash functions.'''
 
Транзакции и их хеши формируются в блоки. Хеш в каждом новом блоке зависит от хеша в предыдущем. Таким образом, все когда-либо совершённые транзакции можно выразить одним числом — хешем последнего блока.
Transactions and their hashes are formed into blocks. The hash in each new block depends on the hash in the previous one. Thus, all transactions ever made can be expressed in one number - the hash of the last block.
 
'''Изменив даже одну транзакцию в любом из предыдущих блоков, изменятся все последующие хеши по цепочке такая версия блокчейна будет считаться недействительной''' .
'''By changing even one transaction in any of the previous blocks, all subsequent hashes along the chain will change such a version of the blockchain will be considered invalid.'''
 
'''На хеш-функциях базируется весь принцип работы блокчейна. Если изменится один блок, то придётся методом перебора восстанавливать все последующие блоки. Чтобы осуществить такой перебор, не хватит никаких ныне существующих вычислительных мощностей'''
'''The whole principle of blockchain operation is based on hash functions. If one block changes, you will have to restore all subsequent blocks by iteration. To carry out such a search, there will not be enough of any existing computing power'''
 




</div>
</div>
<div style="clear:both">
<div style="clear:both">




</div>
</div>
 
</div>
</div>
[[File:Commoninfo-sha256.png|1000px|class=mediacenter]]
  [[Category:Commoninfo]]
  [[Category::Commoninfo]]

Revision as of 08:01, 30 June 2022


Encryption in the blockchain

Blockchain technology is perceived by people as something difficult to understand, but in fact the basic idea is simple. To understand the principle of the blockchain, let's find out how data is encrypted using cryptographic algorithms.

Why encrypt data in the blockchain

Thanks to encryption algorithms, blockchain technology is considered the most secure kind of peer-to-peer networks (a network where everyone is equal to each other). To begin with, let's figure out why to encrypt something in the blockchain.

In the traditional and understandable systems "'client-server'"' the security is the responsibility of the company's server, which ensures the security of the storage of funds (the bank's Server), It performs the following functions:

1. Provides user access to data .
It is the server that stores the logins and passwords of its clients, checks the user before giving him access to the network.

2. Monitors the safety of data .
The server takes care of the confidentiality of user data and does not give attackers access to personal data and information.

3. Controls data change .
Any change is agreed with the server before it takes effect. In this way, data integrity is maintained.

Since each node in the blockchain is both a server and a client at the same time, and there is no central server, cryptography is used for the above purposes.

Cryptographic encryption algorithms perform the above functions without outside interference and now we do not need a bank server for safe storage of funds. Cryptography also answers the question of which encryption algorithm to use for a particular purpose.

Algorithm with hash functions

Blockchain developers needed a type of mathematical functions that easily encrypts information without the possibility of decryption — these are one-way functions.

An example of such a function is multiplication. If we only know the answer, then we cannot say for sure which two numbers were multiplied.

For example, X * Y = 6

Next, we need a type of one-way functions that turns information of arbitrary size into a cipher of a certain length, and these are hash functions. They convert messages into a set of characters (hashes) that can be conveniently and safely used in programming.

Such a set of characters (Hash) can consist of both letters and numbers. Which numbers and letters will be in the hash, as well as how many of them there will be, depends on the hash function selected.

Let's take a closer look at the most famous one — SHA-256, which is also used in the DecimalChain blockchain .

How the SHA-256 hash function works

The SHA-256 hash function is also used in the bitcoin blockchain. SHA stands for "secure hashing algorithm", and the number 256 is the amount of cache in bits.

The operation of the SHA-256 hash function is conceptually similar to the creation of fingerprints. To identify a person, you do not need to know all the information about him: it is enough to know his fingerprint. "'SHA-256 calculates such a "fingerprint" of texts, videos, images, music and other types of information.

The algorithm of operation can be described as follows:

  1. A message arrives at the input — a file up to 2 million terabytes in size.

  2. Mathematical transformations are performed.

  3. The output is a hash — a 64-digit number.

You can encode the text and see how the hash function works / online here

SHA-256 encodes messages instantly . The hashes are very different even with a minor change in the message. The hash changes so much that it has absolutely no similarity between the new and old values. Thanks to this, "the SHA-256 hash function guarantees that it is impossible to change the message"' without changing the hash.

A set of letters and numbers in a hash is a single 64—digit number written in a 16-digit number system. To find two different messages with the same hash, you will have to go through them for millennia, so if two messages have the same hash, then be sure: the messages are the same.

Blockchain transactions

Without hash functions, the existence of a blockchain would be impossible.

The blockchain is unique in that it guarantees the immutability and anonymity of the data it stores. thanks to encryption algorithms. Any data is checked for authenticity before being entered into the blockchain, but no one can see it. The same thing as a banker checks the authenticity of banknotes lying in a closed safe. This is where the hash function helps.

The blockchain regularly updates the data by adding records of changes — transactions. When updating transactional information, any system is vulnerable to attack. Banks mitigate this risk with the help of a centralized architecture and one-sided strict control over user access rights. The blockchain does not have a centralized control body — it is replaced by cryptographic hash functions.

Transactions and their hashes are formed into blocks. The hash in each new block depends on the hash in the previous one. Thus, all transactions ever made can be expressed in one number - the hash of the last block.

By changing even one transaction in any of the previous blocks, all subsequent hashes along the chain will change — such a version of the blockchain will be considered invalid.

The whole principle of blockchain operation is based on hash functions. If one block changes, you will have to restore all subsequent blocks by iteration. To carry out such a search, there will not be enough of any existing computing power