Cryptography in Blockchain

Kareem P. Jackson
Unpluggd Digital
Published in
4 min readApr 29, 2022

Blockchain, as we know, is essentially a collection of data stored as a list in a public database. It is connected by a peer-to-peer network, meaning it does not require a central server to facilitate communication amongst nodes. Instead, each node acts independently, following specific protocols.

The lists of data stored on the blockchain are connected using cryptographic algorithms. These are vital to the functioning of the blockchain because they are used to update datasets which are constantly growing. In this article we’ll take a deeper dive into what cryptography is and how it is used to secure data on the blockchain.

What is Cryptography?

Cryptography is a method of developing techniques and protocols to prevent a third party from accessing and gaining knowledge of the data in private messages during a communication process. It is derived from Greek terms which together mean “secret message.”

There are several main terms which make up cryptography:

  1. Encryption is where normal text is processed into ciphertext (a random sequence of ones and zeros).
  2. A cipher is the mathematical function used to encrypt normal text to ciphertext.
  3. Decryption is usually done by the recipient to get the normal text from the ciphertext.
  4. A key is the small amount of information required to decipher an encryption.

Additionally, there are three different types of cryptographic algorithms:

  1. Symmetric Key cryptography is where a single key is used to encrypt and decrypt the message. The problem with this form is that it is not as secure, since the secret key may be caught by eavesdroppers.
  2. Asymmetric Key cryptography uses a pair of keys by each node. These are the public key and the private key. The public key can be thought of as an unlocked box owned by the recipient which is sent to the sender. When the sender closes the box, only the recipient will have the key to open that box.
  3. Hash Functions use a cipher to generate a hash value which is fixed to the length of the normal text. Changing the normal text slightly will always result in a different hash value.

How Cryptography Can Be Used in Blockchain

The Asymmetric Key cryptography and Hash functions are the two main forms of cryptography used in a blockchain. Asymmetric Key cryptography is important as it allows data to be transferred over insecure channels. Although it is the most secure method of transferring data, it does have its drawbacks, such as when the algorithm has low processing speed and unsatisfactory encryption strength. Asymmetric Key cryptography is responsible for every node having a unique digital signature. These Digital Signatures provide integrity to the process; as they are easily verifiable and cannot be corrupted.

The most commonly used Asymmetric Key cryptographic algorithm is the RSA algorithm. This was first suggested by scientists in 1977. This algorithm generates two prime numbers. These numbers represent a private key, which is known only by the owner. A calculation involving the two numbers as the public key. The public key is shared to any node that wants to communicate. This algorithm is secure because it takes a long time to verify whether a number is prime or not. It would be difficult for a computer to determine the two large prime numbers used in the encryption because that would mean doing many calculations.

Hash functions are important to blockchains due to their key security functions:

  1. The ‘Avalanche’ effect occurs when one value in the normal text is changed. This then changes the entire hash value, which is unacceptable in verification.
  2. The uniqueness of every hash value allows for accountability. There will be no two normal texts with the same hash value and hence no confusion should be expected.
  3. Determinism ensures that one input would always have the same output, once it is operated by the same hash function. These Hash functions are beneficial to use because their values can be generated very quickly.
  4. Finally, the complexity of the hash functions ensures that reverse engineering the value is quite difficult.

Hash functions are used to connect blocks in the blockchain as any changes to the individual hash values will alter the entire blockchain and make it invalid. The hashing algorithm currently used by blockchains is SHA-256. This algorithm was designed by the United States National Security Agency and published in 2001. The SHA-256 algorithm generates 256 bits in each hash value, which makes cracking the code difficult. Other hashing algorithms have been developed, the latest release was SHA-3, released in 2015.

Existing Applications

There are a huge number of applications for cryptography in blockchain technology. The most commonly known application is in cryptocurrency. Cryptocurrencies use asymmetric key cryptography, where the public key is the address of a person and the private key is used to access the information on the blockchain. Digital signatures are typically used to approve smart contracts and sign them securely. Hash functions are used to ensure that the status of the blockchain is always in a state of consensus.

In order to ensure that computer networks remain secure, scientists and engineers are always working on modifying and creating algorithms to strengthen cryptography. As the internet has been such an important part of our modern lives, and with the rise of blockchain and Web3.0, the focus on cryptography continues gaining more serious attention and development.

* * *

Looking to get into the Blockchain space, create your own NFT or to continue growing your DAO? Unpluggd Digital provides services in on-chain software development including dApp creation, protocol implementation and more.

Reach out to set up a chat so we can get to work on your next project.

--

--

Kareem P. Jackson
Unpluggd Digital

I am the founder of a digital product studio, Ghost Savvy Studios....Where Innovation Meets Design