Home>Article> How blockchain is protected using cryptography

How blockchain is protected using cryptography

-
- Original
2018-03-10 09:19:49 1993browse

Cryptography is the science of applying mathematical functions to ensure data security.

Many popular film and television works imply to people that as long as there are powerful enough hackers, any system can be broken into. This type of "Hollywood hack" is not a real-world scenario - hackers must find exposed vulnerabilities in the system, such as unlocked server rooms, easy-to-guess passwords, unprotected network ports, or internally installed "backdoors" , thereby achieving unauthorized access.

While it is true that we can never ensure that a system is free from any vulnerabilities - after all, systems are built by imperfect humans, the idea that "any system can be broken" is wrong. Since the early 1990s, we have been completely immune to hackers using cryptography. However, the application of this technology sometimes leaves room for hackers to exploit it.

Cryptography itself cannot be hacked to generate forged digital signatures (definition will be given shortly), just like mathematics cannot be hacked to make 2+2=5-although cryptography and Mathematics can all be used incorrectly. If a system using cryptography is broken, it can only be because the designer applied the cryptography incorrectly. It's not because cryptography doesn't work, or because someone "broken" cryptography - it's not a math error when your bank mishandles your account, or your mom infects her computer by downloading an unfamiliar attachment. Viruses are not the same as email bugs. This is an important feature because Bitcoin is a very straightforward cryptography application.

Cryptography is not an untested new technology. All of the cryptographic techniques used by Bitcoin have been in use since the dawn of the Internet and are important parts of many common Internet protocols used every day. Computer scientists consider cryptography to be reliable and necessary, just as NASA considers aerospace science to be reliable and necessary.

Public-private key pair: the cornerstone of cryptography

The public-private key pair is the cornerstone of cryptography used in blockchain. A public-private key pair contains two parts: the private key and the public key. These two keys are really nothing more than large integers with a specific mathematical relationship that are used in place of passwords and usernames.

You will have a public key, just like your name or username: in most cases, you can share your public key with any requester, and the person who owns it can use it to To quote or contact you. It is tied to your reputation (or your transaction history in Bitcoin), so you may have multiple public keys (and therefore multiple public-private key pairs) for different purposes. The public key can be used to reference or view an account, but by itself it cannot do anything with the account.

The private key should be like a password: it should not be shared with anyone, it is used to verify certain actions, such as sending BTC (Bitcoin).

But there is an important difference between a private key and a password. To use a password, you must send it to a person or server so that it can be verified. You need to trust that the password will be handled responsibly after it is sent. In contrast, a private key can be used to prove one's identity without sending it to anyone. The only place it has ever been stored or used directly is on your local device.

This is important because if you can authenticate yourself without sending your secret information to anyone, you are guaranteed to have full control over its security - you are less vulnerable to other systems. Impact of security breaches. This is an important part of what makes Bitcoin unshakable. Bitcoin itself does not store passwords or private keys that could be leaked to attackers, but users can still verify transactions.

But if you never send your private key to anyone, how do you use your private key to verify transactions? The answer has to do with the mathematical relationship between private and public keys: digital signatures.

Digital Signatures

There are many different techniques for generating and verifying digital signatures, and the mathematics that underpin their work are well beyond the scope of this article. For those unfamiliar with cryptography, the process described here may initially sound unbelievable. I distinctly remember feeling this way when I first started studying Bitcoin four years ago.

Now I will briefly mention again that these techniques are used in many common Internet protocols and are an established part of information science.

Imagine there are two people, Alice and Bob, who have exchanged public keys privately. Alice wants to send a message to Bob, but Bob is a very suspicious person and does not believe that the message really comes from Alice unless he can prove it mathematically and deterministically. To facilitate proof, they agreed to use digital signatures.

To generate a signature, Alice uses a signature generation algorithm in her computer, which takes as input her private key and the complete message to generate a digital signature. She then sends this message/signature combination to Bob - but importantly, she does not send her private key.

When Bob receives the message and signature, he can invoke a complementary signature verification algorithm. The algorithm takes as input a message and a signature to determine the public key from the public-private key pair used by Alice to generate the signature. When Bob sees that his algorithm outputs Alice's public key, he has mathematically proven that the signature was indeed generated using Alice's public-private key pair, even if he does not know and cannot calculate the private key in Alice's public-private key pair. key.

More succinctly, this process of digital signing allows Bob to verify that the message was not created or modified by some third party, but must have been generated using Alice's private key, without having to (or cannot) Know her private key. All he needs is the message/signature combination and her public key.

Intuitively, this may seem implausible, and you may feel as if there is a misunderstanding somewhere. If Alice's private key and public key are closely related, and Alice uses her private key to generate the signature that Bob receives, then why can he only derive her public key but not her private key? Understanding the answer to this question requires a deeper understanding of mathematics than most people have, and is well beyond the scope of this book.

Despite this, the technology is relied upon every day and is considered rock solid within the cryptography community. When you visit a website whose address begins with https, the "s" indicates that the website authenticated itself using a digital signature. Your computer uses a signature verification algorithm, like Bob in the example above, to verify that the website actually comes from the correct public-private key pair. Digital signatures ensure that any further interactions between you and the website are encrypted and authenticated. If verification fails, the browser will warn you and mark the site as dangerous.

Big enough integer

Before this, I briefly mentioned that private and public keys function just like usernames and passwords, but in fact they just have a special mathematical relationship of large integers. Given this, I often get asked the following question: "Could you use a computer to guess or calculate a bunch of numbers and try to use them as a private key? Could they eventually hit a target public or private key?" "In fact, in the case of Bitcoin, this would make it possible for an attacker to steal some of the Bitcoins held by the public-private key pair."

That's a good question, but it's not going to happen. As mentioned before, there are several Bitcoin addresses that hold millions of dollars worth of BTC, but they have not been moved in years - even though all it takes to steal them is the right private key - which is the right big integer ! If you can guess the private keys of these addresses, then you can send the money from them to anyone. Unlike passwords, you can verify private keys locally on your machine, and there is no server limiting the number or frequency of your attempts.

Then why hasn’t anyone stolen the money yet? The answer lies in the almost ridiculous size of the numbers used as private keys. They are big enough.

We start with a simple thought experiment. Imagine that your private key is large enough that all the computers in the world working together would take them 24 hours to guess it. If you add just one digit to your private key, the computer will need ten times the computational effort, which means it will take ten days instead of one. Adding six digits would bring that time to 27,000 years.

In any case, the computational power required to create random numbers to generate a private key is trivial. Generating signatures using private keys and verifying these signatures using public keys is also computationally simple. But the amount of work required to guess the private key increases exponentially with each additional number added. To make a private key "immune" to brute force, we just need to add enough numbers - we just need to make them large enough.

How big is it? The private key used in Bitcoin is a 256-bit integer, which is equivalent to a number with a length of 76 bits. The size of this number is incredible. Most of the following explanations come from Bruce Schneier's book "Applied Cryptography", which provides an intuitive explanation of large enough integers.

First of all, you need to understand that a specific conclusion of the second law of thermodynamics is the minimum energy required to change the existence of a single binary bit of information (change 1 to 0 or vice versa). This means that regardless of the hardware used, any computational process requires some minimal energy to perform.

Now imagine that you are able to harness the entire energy output of the sun to power a specially designed computer whose job is to calculate or guess the private key to find a public-private key pair (that can control BTC ).

Using a little math and thermodynamics, you'll find that a highly efficient computer with the power to calculate the sun's energy output for an entire year can calculate 2178 values. If we divide this value by the number of possible private keys, which is 2256, we find that this hypothetical computer with the computing power of the sun's annual energy output can only guess or calculate 0.0000000000000000000003% of the total number of possible private keys.

Also, this is just a count and does not include the more complex task of actually checking each private key to verify that it corresponds to the correct public key. So this computer could miss the correct private key 0.0000000000000000000003% of the time in a year without it even realizing it.

These numbers have nothing to do with the technology of the device; they are the maximum possible values based on the laws of thermodynamics established since the 1930s. These numbers mean that a brute force attack on a 256-bit key (the one used by Bitcoin) would be infeasible unless the computer was built from something other than matter and took up something other than space.

This is the ability of large enough integers. No matter how powerful a hacker is, unless he can use the power of 3×1023 suns to calculate a year, or the power of one sun to calculate 3×1023 years, his computer cannot even finish counting all the private keys—let alone Test or otherwise use them.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:10 Best Alternatives to TOR Next article:10 Best Alternatives to TOR