Welcome back to Flash Learn, your weekly series in learning all about blockchain!
Last week we started to explore the technical components of blockchain technology with hashing. This week we continue with another key role: public-key cryptography. Let’s dive in blockheads!
What is cryptography?
First of all, cryptography is the study and practice of secure communication, concealing messages from third parties with logical and mathematical functions.
Cryptography can be traced back to all the way to Ancient Egypt, and was used ever since- Julius Ceasar reinvented the wheel with his Ceasar cipher, and in World War II the German army concealed their messages with the help of the Enigma machine.
Therefore, during encryption, a piece of secret information is converted into a cipher– seemingly unreadable coded text. To reveal the original message we need to decrypt the code with the cipher key.
Modern technology enabled us to make more and more complex ciphers, and also enhanced cryptanalysis- the science of breaking the encryption. With computers, we can encrypt not only language texts, but any kind of digital information.
Computational hardness assumption is the basis for algorithm design. It means that it is theoretically possible to break the decrypted information by brute force attack- guessing the correct key until you get it right. However, running all the possible solutions while trying to decrypt the message is infeasible by our current means-it would take too much time and computational power. Think in the range of 100 computers working for 100 years.
The recent expansion of the cryptographic field covers e-commerce, credit cards, messaging, password management, and so on- it is something we use unknowingly every day.
Furthermore, the blockchain technology uses asymmetric encryption systems, alias public-key cryptography.
In public-key cryptography, the information is concealed by two keys. A public and a private key connected in a mathematical algorithm.
How it works:
- Alice decides to send a message to Bob in secret. Alice encrypts the message with Bob’s public key and sends him the data. When Bob receives the data, he will decrypt it with his private key, and get the original information from Alice.
- None can solve the keys just by guessing.
- Only the private key pair of the public key can decode the encryption.
- No secret hacking- if someone tries to manipulate an encoded message sent with the public key along the way, the private key will not be able to open it anymore
Super simple example!
Suppose that the public key is like a box with a lock, and Alice wants to send something to Bob. Alice gets the box with a lock from Bob, puts all kind of fun stuff inside, then locks it. Alice sends the locked box to Bob, and only Bob will be able to open the lock with his own private key.
There is some very cool mathematics behind asymmetrical cryptography, if you feel like grinding your brain, go for it here!
In the blockchain world:
- the public key is the address of the digital wallet, where one can keep tokenized assets, digital currencies, private information. To receive funds, one has to share their public key with the sender.
- the private key grants access to manipulate the contents of the digital wallet and should be kept secret and safe.
- the most significant threat of private keys is a human flaw- storing the private key to our wallet unsafely.
Public-key cryptography is also the technology behind digital signatures. As a result, is helping to verify the identity. Alice encodes the message with its private key, so Bob will be able to verify the message with Alice’s public key.
Most importantly, public-key cryptography is a key feature in providing security on the blockchain. Therefore ensures that outside actors cannot see nor manipulate our transactions and assets.
Join us next week again to discover Smart Contracts here at Flash Learn!