Encryption: Difference between revisions

From Decimal Wiki
Jump to navigation Jump to search
[unchecked revision][checked revision]
m (CryptoUser moved page Commoninfo:blockchainencryption to Encryption)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<div class="mikio-article-content">
{{#seo:
                    |title= Encryption in the blockchain — Decimal Wiki
                    |titlemode= append
                    |keywords= Encryption in the blockchain
                    |description= Encryption in the blockchain
                    }}
'''Encryption in the blockchain''' refers to the process of converting [[data]] into a secure and unreadable format to protect it from unauthorized access or tampering. It ensures that sensitive information transmitted or stored in the [[blockchain]] remains confidential and secure.
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 [[cryptography|cryptographic]] [[algorithm]]s.
== Why encrypt data in the blockchain ==
Thanks to encryption algorithms, blockchain technology is considered the most secure kind of [[P2P|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:
# '''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.
# '''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.
# '''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, <math>X \times Y = 6</math>
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 ([[hash]]es) 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|Decimal blockchain]]'''.
=== How the SHA-256 hash function works ===
The [[SHA-256]] [[hash function]] is also used in the [[Bitcoin|Bitcoin blockchain]]. ''SHA'' stands for "Secure Hashing Algorithm", and the number 256 is the amount of cache in [[wikipedia:bit|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:'''
* A message arrives at the input — a file up to 2 million [[wikipedia:terabyte|terabytes]] in size.
* Mathematical transformations are performed.
* The output is a hash — a 64-digit number.
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|thumb|left]]<br clear="all">
''SHA-256 encodes messages instantly''. The [[hash]]es 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 algorithm|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 — ''[[transaction]]s''. 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 [[hash function|cryptographic hash functions]].''
Transactions and their hashes are formed into [[block]]s. 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 class="mikio-tags">
== See also ==
* [[Hash function]]
* [[Encryption algorithm]]


 
[[Category:Commoninfo]]
 
[[Category:Crypto security]]
</div>
[[Category:Blockchain]]
<span id="shifrovanie_v_blokchejne"></span>
= Шифрование в блокчейне =
 
<div class="level1">
 
Блокчейн-технология воспринимается людьми как что-то сложное для понимания, но на самом деле основная идея проста. Чтобы разобраться с принципом работы блокчейна, давайте выясним, как с помощью криптографических алгоритмов шифруются данные.
 
 
</div>
<span id="zachem_shifrovat_dannye_v_blokchejne"></span>
= Зачем шифровать данные в блокчейне =
 
<div class="level1">
 
Благодаря алгоритмам шифрования технология блокчейн считается самой безопасной разновидностью одноранговых сетей (Сеть где все равны между собой) . Для начала разберёмся, зачем в блокчейне что-то шифровать.
 
В традиционных и понятных нам системах '''«клиент-сервер»''' за безопасность отвечает сервер компании, которая обеспечивает безопасность хранения денежных средств ( Сервер банка) Он выполняет следующие функции:
 
1. '''Обеспечивает доступ пользователей к данным''' .<br />
Именно сервер хранит логины и пароли своих клиентов, проверяет пользователя, прежде чем дать ему доступ к сети.
 
2. '''Следит за сохранностью данных''' .<br />
Сервер заботится о конфиденциальности данных пользователей и не даёт злоумышленникам доступ к личным данным и информации.
 
3. '''Контролирует изменение данных''' .<br />
Любое изменение, прежде чем вступить в силу, согласуется с сервером. Таким образом поддерживается целостность данных.
 
'''Так как в блокчейне каждый узел является и сервером, и клиентом одновременно, а центральный сервер отсутствует, для вышеперечисленных целей применяют криптографию.'''
 
Криптографические алгоритмы шифрования выполняют вышеописанные функции без постороннего вмешательства и нам теперь не нужен сервер банка для безопасного хранения денежных средств. Также криптография отвечает на вопрос, какой использовать алгоритм шифрования для той или иной цели.
 
 
</div>
<span id="algoritm_s_xesh-funkcijami"></span>
= Алгоритм с хеш-функциями =
 
<div class="level1">
 
Разработчикам блокчейна был необходим такой тип математических функций, которые '''легко шифрует информацию''' без возможности расшифровки, — это односторонние функции.
 
Пример такой функции — умножение. Если мы знаем только ответ, то не можем однозначно сказать, какие два числа были умножены.
 
Например, Х * У = 6
 
Далее нужен такой тип односторонних функций, который '''превращает информацию произвольного размера в шифр определённой длины''' , и это хеш-функции. Они преобразуют сообщения в набор символов (хеши), которые можно удобно и безопасно использовать в программировании.
 
Такой набор символов (Хэш) может состоять как из букв, так и из цифр. Какие цифры и буквы будут в хеше, а также сколько их будет, зависит от выбранной хеш-функции.
 
'''Рассмотрим подробнее наиболее известную — SHA-256, которая также используется в блокчейне DecimalChain''' .
 
 
</div>
<span id="kak_rabotaet_xesh-funkcija_sha-256"></span>
= Как работает хеш-функция SHA-256 =
 
<div class="level1">
 
Хэш-функция SHA-256 используется и в блокчейне биткоина. SHA означает «безопасный алгоритм хеширования»‎, а число 256 — объём кеша в битах.
 
Работа хеш-функции SHA-256 концептуально напоминает создание отпечатков пальцев. Чтобы идентифицировать человека, не надо знать всю информацию о нём: достаточно знать отпечаток его пальца. '''SHA-256 вычисляет такой «отпечаток» у текстов, видео, изображений, музыки и других видов информации.'''
 
'''Алгоритм работы можно описать следующим образом:'''
 
<ol>
<li><div class="li">
 
На вход поступает сообщение — файл размером до 2 млн терабайт.
 
</div></li>
<li><div class="li">
 
Выполняются математические преобразования.
 
</div></li>
<li><div class="li">
 
На выходе получается хеш — 64-значное число.
 
</div></li></ol>
 
Закодировать текст и посмотреть, как работает хеш-функция, можно [http://crypt-online.ru/crypts/sha256/ онлайн тут]
[[File:Commoninfo-sha256.png|1000px|class=mediacenter]]
 
'''SHA-256 кодирует сообщения моментально''' . Хеши сильно отличаются даже при незначительном изменении в сообщении. Хеш меняется настолько, что абсолютно не имеет сходства между новым и старым значениями. Благодаря этому '''хеш-функция SHA-256 гарантирует невозможность изменения сообщения''' , не меняя хеша.
 
Набор из букв и цифр в хеше — это одно 64-значное число, записанное в 16-ричной системе счисления. Чтобы найти два разных сообщения с одинаковым хешем, придётся перебирать их тысячелетиями, поэтому если два сообщения имеют одинаковый хеш, то будьте уверены: сообщения одинаковые.
 
 
</div>
<span id="tranzakcii_v_blokchejne"></span>
 
= Транзакции в блокчейне =
 
<div class="level1">
 
'''Без хеш-функций существование блокчейна было бы невозможно''' .
 
Блокчейн уникален тем, что гарантирует неизменность и анонимность данных, которые он хранит. благодаря алгоритмам шифрования. Любые данные перед внесением в блокчейн проверяются на подлинность, но при этом никто не может их увидеть. То же самое, что банкир проверяет подлинность банкнот, лежащих в закрытом сейфе. В этом и помогает хеш-функция.
 
Блокчейн регулярно обновляет данные, добавляя записи об изменениях — «транзакции». При обновлении транзакционной информации любая система уязвима для атаки. Банки нивелируют этот риск с помощью централизованной архитектуры и одностороннего строгого контроля за правами доступа пользователей. '''У блокчейна нет централизованного органа контроля — его заменяют криптографические хеш-функции''' .
 
Транзакции и их хеши формируются в блоки. Хеш в каждом новом блоке зависит от хеша в предыдущем. Таким образом, все когда-либо совершённые транзакции можно выразить одним числом — хешем последнего блока.
 
'''Изменив даже одну транзакцию в любом из предыдущих блоков, изменятся все последующие хеши по цепочке — такая версия блокчейна будет считаться недействительной''' .
 
'''На хеш-функциях базируется весь принцип работы блокчейна. Если изменится один блок, то придётся методом перебора восстанавливать все последующие блоки. Чтобы осуществить такой перебор, не хватит никаких ныне существующих вычислительных мощностей'''
 
 
 
</div>
<div style="clear:both">
 
 
 
</div>
 
</div>
[[File:Commoninfo-sha256.png|1000px|class=mediacenter]]  
[[Category::Commoninfo]]

Latest revision as of 10:53, 15 February 2024

Encryption in the blockchain refers to the process of converting data into a secure and unreadable format to protect it from unauthorized access or tampering. It ensures that sensitive information transmitted or stored in the blockchain remains confidential and secure.

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,

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 Decimal 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:

  • A message arrives at the input — a file up to 2 million terabytes in size.
  • Mathematical transformations are performed.
  • 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.

Pay attention!  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.

See also