a generalised and simplified look at cryptography in the cryptocurrency sphere
Encryption has been around for quite a while, the earliest known takes us back to 1000BC. However, from the earliest substitution ciphers to the more complex encryption enabled by machines (Enigma for example) and computers they had one thing in common – both sender and recipient needed to know the key used for the encryption. If not, then the received message was just garbage. This is known as symmetric encryption as the same key is both the encryptor and decryptor.
This was its primary weakness – how did the sender get the key to the recipient without it falling into the hands of others? In terms of Bitcoin it would mean the sender and receiver of a transaction would have to share a key – very impractical considering the number of transactions that take place.
What was needed was a way to transfer keys without the risk of interception and the way to do this was developed (publicly) in the late 1970s1 . This is known as Public Key or Asymmetric Encryption.
This meant a message used two keys: a private key and a public key. The beauty of this is that a message encrypted with my public key can only be decrypted with my private key and, anything encrypted with my private key can only be decrypted with the matching public key.
This means you can publish your public key far and wide meaning anyone can you send you a message that only you can decrypt. Also I can send a message encrypted with my private key and anyone can be certain that I sent it because that can decrypt it with my public key. I can send a message to the World and people can be certain it came from me because it is only readable by using my public key. And anyone can send me a message encrypted with my public key and only I can decrypt it.
But if I just want people to be certain it was me that sent a message I don’t need to encrypt the message – what’s the point anyway, the whole World has access to my public key. I just need to verify that I sent it. I can do this by stamping the message.
To do this I create a digest – a summary of the message which is then encrypted with my private key. This means anyone who wants to be certain that I sent the message can verify the digest using my public key.
How is that done?
First, create a digest or summary of the message which we will be fairly confident will be unique. We can use a hashing algorithm such as SHA256 to do this.
Next, encrypt this summary using your private key and send the result along with your message.
Finally, to verify the message. When the recipient views your messages they can recreate a summary using the same method you did; decrypt the digest that you sent with your public key and check that it matches the one they created.
Now one of the strange things about Bitcoin is that even though it is called a crypto currency the actual transactions aren’t encrypted. You can see every transaction – what address sent it, what address received it, how much was transacted and so on
The transactions are secured by using this ‘stamping’ process and you can spend the Bitcoin sent to you by using your private key to prove they are rightfully yours. Just don’t give your Private Key to anyone or they will also be able to prove rightful access!