0.2 Symmetric vs Asymmetric Encryption
Now that we have presented hash functions, we can begin understanding where the crypto from cryptocurrency comes from.
Let's suppose we are a group of people that do not know each other, and we want to create a ledger to track transactions between one another. First, we need a way to identify one another: at least the ledger should contain the basic informations for each transaction:
A sends 3 coins to B
Here "A" and "B" are identifiers for our users. But we also want a way to authenticate our messages: such a transaction should only be submittable by A and only by A.
One way we could do this is simply by having a central actor keeping the ledger. He could have a list of usernames and password in a database. A user would then be able make a transaction by sending its username and password along with the transaction to the central actor, to authenticate the transaction. For instance:
A sends to central actor the message: "A sends 3 coins to B; Password of A".
This is a (over-)simplification of how banks actually work. The problem with this strategy is it introduces a central actor that you need to trust: not to introduce forged transaction to the ledger, not to censor users he does not want to be able to transact with others. To understand how we came up with a trust-less approach, we need to turn to cryptography.
Cryptography, the science of securing communication, has been around for thousands of years. From ancient ciphers used by the Greeks and Romans to modern encryption algorithms that protect data on the internet, cryptography has always been about ensuring privacy of communications and authenticity of the origin of messages.
A simple method of securing messages is symmetric encryption. In this system, both the sender and the recipient share the same secret key. This key is used both to encrypt and decrypt messages, ensuring that only authorized parties can read them.
An example of symmetric encryption is the Caesar cipher, one of the earliest encryption methods. In the Caesar cipher, each letter in a message is shifted by a fixed number of places in the alphabet. For example, shifting by three places, "HELLO" becomes "KHOOR." While simple, this method is vulnerable to attacks as the key (the shift value) is easy to guess. Modern symmetric encryption methods, such as AES (Advanced Encryption Standard), are much more secure.
However, symmetric encryption has a major limitation: you have to send the key to the person who will be able to decrypt the message you want to send. If he's across the internet for instance, there is really no way to use asymmetric encryption exclusively to secure your communications.
To overcome the limitations of symmetric encryption, we use asymmetric encryption. Instead of a single shared key, each participant has a pair of keys: a public key and a private key. The public key can be freely shared, while the private key remains secret. If someone wants to send a secure message to a recipient, they encrypt it using the recipient's public key. Only the recipient, with their private key, can decrypt and read the message.
An example of asymmetric encryption is RSA (Rivest-Shamir-Adleman). In RSA, a message encrypted with a recipient’s public key can only be decrypted with their corresponding private key. This method is widely used in securing online communications, including SSL/TLS protocols for web security, and is not in the scope of this course.
In the next chapter, we'll describe another asymmetric cryptography scheme that will help solve the identification/authentication problem on decentralized ledger of transactions.
Last updated