Asymmetric cryptography — How did it impact on blockchain?
Have you ever been thinking about crypto wallets?
Do you know why exactly it consist a pair of two keys?
Why is there a need to sign transactions with private key?
For what reason learn all of it?
Agenda:
- introduction,
- How asymmetric cryptography works,
- Colors analogy — the simplest explanation,
- Mathematical explanation,
- Impact on blockchain.
Introduction
Everyone has to use messaging apps in todays world. Practically, every time the message is send, middleman sees who sent it, what he typed, etc. Nobody prefers to showing all messages for services, or endangering it for some kind of “data leaks”.
The solution for more privacy in texting and many more is an asymmetric cryptography. It allows to safely data exchanging, only sender and receiver knows what message includes.
How it works?
Asymmetric cryptography is basing on usage of the pair of keys: public and private key. It encrypts/decrypts data with private key, which is secretly stored by the users. Public key allows to receive coded message.
It works practically the same as crypto wallet, see my latest material about it.
https://twitter.com/kacperhernacki/status/1545824577791696897?s=21
Colors analogy — the simplest explanation
Asymmetric cryptography can be super easily explained with changing keys into the colors. Let’s go through that process:
Firstly, let’s assume the situation where there are three people — Sender, Receiver and spy. Spy can not know, about what Sender and receiver are chatting.
Both of Sender and receiver select the public key (yellow color) and announce it. Now, everyone knows that they are using this concrete one. Next, it is needed to use easy function to solve, but extremely difficult and practically impossible to revert.
In this example, this function is color mixing. Sender and receiver generate private key and do not share it with others (sender — blue, receiver — red). They mix it with public key, then as the result they have a mixture of public yellow color and private color.
In the next step, they are exchanging with those mixtures. It is worth to mention, that the spy will not reverse from mixture and public color, the private color. It’ll know everything is safe, but seems to not be functional…
Next, participants of the conversation, mix the mixture with their own private color. The result is fabulous. They own the same mixture, without sharing it to the spy. This result is a key to encrypting data.
Mathematical explanation
To cover it mathematically, there is a need to use numbers and the function, which is hard to revert. This function is modulo. Let’s jump into the definition:
In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another. Given two positive numbers a and n, a modulo n is the remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor.
It is the operation which is super easy to compute, but practically not possible to revert. If there are used super long, primary numbers, all computing power on the planet, will not revert it after hundreds of years. It looks impressive…
Going back to the colors analogy, with smaller primary numbers instead of long. Publicly are announced to numbers: prime modulus and the generator: g and p, for example g = 3 and p = 17.
Then sender and receiver choose primary numbers and calculate g to the power of private key mod p, 3^15 mod 17. Receiver does the same with his private number. Next, they exchanges with the results.
The tricky part, when both of them will take received results and calculate it to the power of own private number, then take the mod operator to p (17 in this case), they will obtain the same result. It is the entire process of asymmetric encryption.
Great explanation is available in this video: https://youtu.be/YEBfamv-_do
Impact on blockchain
Asymmetric encryption has the huge impact on blockchain technology. Each wallet has a pair of keys, which are mathematically connected. Private key is also a secret one, which signs transactions and proofs that concrete user is an owner.
Validation and authentication of holdings, signing transactions, receiving transactions is totally based on mentioned technology. However, public key is understood as an address of wallet, it also takes action in encryption due to asymmetric cryptography.