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 2: Centralised vs. Decentralised Databases
Part 4: Private-key Cryptography
Part 5: Public-key Cryptography
Part 6: Cryptography and Digital Signatures
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.
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.
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)
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.
- Caesar Cipher Uses Symmetric Key Crytography
- TRUE
- FALSE
Answer Key
- 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:
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.
- The two parties need some way to agree on the private key
- Sender A needs a different key for each receiver
- 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
- Unblocking the Blockchain: Digital Signatures
How does Blockchain ensure that validated transactions cannot be altered and tampered with?
Next Article
- Unblocking the Blockchain: Public-Key Cryptography
Blockchain use Public-key Cryptography (asymmetric key algorithms) to protect transaction messages across the network.
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