What if anyone could see everything you do on Google? What about all the information you send to the banking app? No one would use the Internet. Fortunately, modern web applications use cryptography, particularly encryption, to keep information private. Blockchain also uses cryptography, in particular “asymmetric cryptography.”
Cryptography is the science of secure communication in the presence of hostile behavior. In practice, cryptography often includes encryption protocols that keep messages between senders and receivers confidential. Cryptography also includes other ideas such as hashing. The process of converting data into an illegible form to thwart attackers is called “encryption,” and the encrypted data is called “ciphertext.” The process of converting this illegible data back into its original form for the intended recipient is called “decryption.” Unencrypted or decrypted data is called “plaintext.” The Internet and modern computers rely heavily on encryption as a critical element in their security models.
There are two types of cryptography and thus encryption: symmetric cryptography and asymmetric cryptography. Encryption protocols often use the concept of “cryptographic keys” or simply “keys”, which are strings of data created and used in encryption and decryption processes. In symmetric key protocols, all parties use the same key, called the “secret key,” to encrypt and decrypt messages. Thus, “symmetric key encryption” is often referred to as “secret key encryption.” In asymmetric encryption, which is widely used in blockchain, a computer generates two different keys simultaneously: a “private key” and a “public key.” The private key is a random 256-bit number. Blockchain uses “elliptic curve” cryptography to create public keys from private keys. I will talk more about elliptic cryptography in a future article, but for now you can read about it in the description below. The private key is kept secret by the entity which created the key pair. The public key is shared with other parties. The public key can decrypt any messages encrypted by the private key, and the private key can decrypt any messages encrypted by the public key. Thus, the private key owner is the only party that can receive and view messages created by any public key owner.
To get an intuitive idea of how asymmetric cryptography keeps messages private, imagine that private key owners own a locked mailbox with a public address. Only the owner of the private key can open the box with his key and read the messages in it. A public key can be represented as a token with the address of the mailbox. Anyone who has a copy of this token can send messages to the owner of the private key.
The practice of sending authenticated messages using asymmetric cryptography is called Digital Signatures. To send a digitally signed message, the private key owner must first create a hash of the message they want to send. The private key owner then encrypts the hash with his private key. The message along with the encrypted hash is sent to the recipient who holds the public key. The recipient can decrypt the hash with his public key, hash the original message, and compare the hashes. If the hashes match, the recipient can be sure that the message was sent by the owner of the private key and that it has not been tampered with. Of course, this assumes that the owner keeps his private key secret.
Blockchain uses asymmetric cryptography, particularly in cryptocurrencies. Public and private keys are protected in cryptocurrencies to create accounts and sign transactions sent to the blockchain.
To summarize, asymmetric cryptography secures the Internet and virtually all modern digital devices with encryption and digital signatures. Blockchain primarily uses asymmetric cryptography in cryptocurrencies to sign transactions and send them to the blockchain. Asymmetric cryptography will continue to evolve and become an important component of blockchain and the Internet. And now you are one step closer to understanding how it all works.