Unblocking the Blockchain: Private-Key Cryptography

Updated on October 9, 2018
hengkiong profile image

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

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.

What is Cryptography?
What is Cryptography?

Ancient Cryptography

To help us understand Cryptography better, let's look at an example of how Cryptography was implemented in the past before 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"

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)

What Is Mod?

Mod, also known as modulus, has the mathematical symbol "%".

For example, y mod x is equal to the remainder after dividing y by x.

Hence, 53 % 26 should return 1, since 53/26 = 2, with a remainder of 1

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

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.

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.

Questions & Answers

    © 2018 Heng Kiong Yap

    Comments

      0 of 8192 characters used
      Post Comment

      No comments yet.

      working

      This website uses cookies

      As a user in the EEA, your approval is needed on a few things. To provide a better website experience, toughnickel.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

      For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://toughnickel.com/privacy-policy#gdpr

      Show Details
      Necessary
      HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
      LoginThis is necessary to sign in to the HubPages Service.
      Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
      AkismetThis is used to detect comment spam. (Privacy Policy)
      HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
      HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
      Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
      CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
      Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
      Features
      Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
      Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
      Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
      Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
      Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
      VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
      PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
      Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
      MavenThis supports the Maven widget and search functionality. (Privacy Policy)
      Marketing
      Google AdSenseThis is an ad network. (Privacy Policy)
      Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
      Index ExchangeThis is an ad network. (Privacy Policy)
      SovrnThis is an ad network. (Privacy Policy)
      Facebook AdsThis is an ad network. (Privacy Policy)
      Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
      AppNexusThis is an ad network. (Privacy Policy)
      OpenxThis is an ad network. (Privacy Policy)
      Rubicon ProjectThis is an ad network. (Privacy Policy)
      TripleLiftThis is an ad network. (Privacy Policy)
      Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
      Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
      Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
      Statistics
      Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
      ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
      Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
      ClickscoThis is a data management platform studying reader behavior (Privacy Policy)