Unblocking the Blockchain: Private-Key Cryptography - ToughNickel - Money
Updated date:

Unblocking the Blockchain: Private-Key Cryptography

Heng Kiong teaches Information Technology, including business analytics and management information systems, at a tertiary institute.

Article Navigation

Check out the full series:

Part 1: What Is Blockchain?

Part 2: Centralised vs. Decentralised Databases

Part 3: Digital Signatures

Part 4: Private-key Cryptography

Part 5: Public-key Cryptography

Part 6: Cryptography and Digital Signatures

Part 7: Hashing

A diagram explaining cryptography.

A diagram explaining cryptography.

What Is Cryptography?

Cryptography is the encrypting and decrypting of information using complex mathematical algorithms ensuring that information is originated from the sender and can only be viewed by the intended recipient.

Ancient Cryptography

To help us understand cryptography better, let's look at an example of how cryptography was implemented in the past before the Internet.

Caesar Cypher, also known as "Shift Cipher" or "Substitution Cipher," is one of the simplest and earliest known encryption techniques. Each alphabet in the Plaintext is replaced by an alphabet by shifting a fixed number of positions down the order, pre-determined and known to both the sender and the receiver. This "number" is the private key and will be subsequently used by the intended recipient to unlock the message.

Caesar cryptography example with a shift of 1.

Caesar cryptography example with a shift of 1.

Assume "1" is the chosen private key.

You will see from the diagram above that every alphabet has been shifted 1 position to the right. A is replaced by B, B is replaced by C and so on.

The word BLOCKCHAIN will be replaced by CMPDLDIBJO when sent, as shown below.

Caesar cryptography example: encryption of the word "Blockchain".

Caesar cryptography example: encryption of the word "Blockchain".

public-key-cryptography
public-key-cryptography

Mathematical Implementation of Caesar Cryptography

We shall now examine how Caesar cryptography is implemented mathematically.

Assuming that the private key is now "5". As shown below, "A" is replaced by "F", "B" by "G" and so on.

Encryption and decryption of a letter x by a shift n can be represented mathematically using

En (x) = (x+n) mod (26), and

Dn (x) = (x-n) mod (26)

Caesar cryptography encryption.

Caesar cryptography encryption.

First convert letters to numbers; "A" -> 1; "B" -> 2 and so on.

Using the same example above, since the private key is 5, the letter "B" will be replaced by "G" as shown below.

Convert “B” to 2

En (2) = (2+5) mod (26) = 7 mod (26) = 7 (7 is "G")

Thus, letter "B" is replaced by "G"

Similarly,

Dn (7) = (7-5) mod (26) = 2 mod (26) = 2 (2 is "B")

letter "G" becomes "B" after decrypting using the same private key 5

Quiz

For each question, choose the best answer. The answer key is below.

  1. Caesar Cipher Uses Symmetric Key Crytography
    • TRUE
    • FALSE

Answer Key

  1. TRUE

What Do You Observe?

Caesar Cipher is a rather weak cryptography technique for encryption of plaintexts. Both the encryption and decryption private keys are the same. The plaintext can be easily figured out by reversing the Caesar Cipher. Furthermore, the sender has to remember different private keys when sending to multiple recipients.

Cryptography uses mathematics to encrypt data so that only the intended recipient can read this encrypted data.

A private key is used to securely encrypt the plaintext to convert it into a ciphertext before sending to the recipient. The ciphertext is in an unreadable encrypted format. The intended recipient would need the same private key to decrypt the ciphertext (encrypted data) into something readable (plaintext).

This encryption technique is also known as symmetric key cryptography.

Symmetric Key Cryptography

To further elaborate on symmetric key cryptography, let's look at the following example:

Explanation of symmetric key cryptography using physical keys and locks.

Explanation of symmetric key cryptography using physical keys and locks.

Whenever A wishes to send a secret message to someone, he will use one of his private keys to lock the message. This is a very simple way to encrypt important information. However, there are also issues with this type of symmetric key cryptography.

  1. The two parties need some way to agree on the private key
  2. Sender A needs a different key for each receiver
  3. Anyone with the key can decrypt the message

Symmetric key cryptography uses the same private key to encrypt and decrypt data. Therefore, the two communicating parties have to securely share this same private key in order for this method to work. The reason why you are encrypting a message is because you do not trust the communication channel. Hence, this may be not be so easily achieved without the risk of being intercepted.

While symmetric key cryptography works well for some applications, it is not secure enough for communication purposes. For example, anyone on the network with access to your private key will be able to decrypt the message.

In addition, symmetric key cryptography is non-repudiation. This is because in symmetric key cryptography the receiver also has the same private key. Therefore there is no way to prove if the message was actually sent by the sender.

What's Next?

We need something more secure for Blockchain. We will look at asymmetric key cryptography or public-private key encryption in the next article.

Previous Article

Next Article

References

https://en.wikipedia.org/wiki/Caesar_cipher

This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.

© 2018 Heng Kiong Yap