Written words were one of the greatest inventions in human history. The ability to write down the information raised the need to conceal it. This need was the reason why we study cryptography today.
The early evidence of cryptography was found in ‘ The Histories’, a book written by Herodotus—the father of history. In this book, where he narrated the conflict between Greece and Persians, he described how steganography was used by Demaratus (a Greek who was expelled from Greece) to warn Greece about the Persian attack.
Demaratus used a wooden folding table to deliver his message secretly. He used to write messages on the wood and cover it with a layer of wax thus hiding the message. This way of hiding messages is called steganography.
Along with steganography there was also development of cryptography. In cryptography the message is not hidden, instead the meaning of the message is changed using encryption. The message is scrambled using some protocol. Both sender and receiver agree on the protocol. Sender uses the protocol to encrypt the message and the receiver uses it to decrypt the message.
Further, Cryptography is divided into two categories: 1) Transposition 2) Substitution.
In transposition letters are rearranged to hide the message. It was first used by Caesar Cipher.
In substitution letters are replaced by another letter using some protocol on which both sender and receiver agree. The first evidence of this is found in Kama-sutra, a text written in the fourth century A.D. by the Brahmin scholar Vatsyayana.
Further substitution is divided into Code and Cipher. In Code the entire word is replaced by another word whereas in Cipher, the letter is replaced by another letter.
In this article we will discuss how cryptography is used to achieve secured transitions in blockchain.
It is important to secure user information and transition data in order to encourage users to join blockchain. Digital encryption technology is the key element in blockchain technology and this gave rise to blockchain cryptography. The blockchain acts as a representative of a decentralised database by storing all user transaction information in the blockchain. So it makes sense to identify very high needs for blockchain security performance.
Since blockchain is based on a peer-to-peer distributed network model, there is no single node and the nodes do not need to trust each other and this is why blockchain also needs to protect user transaction information for unsecured channels and also maintain transactional integrity.
Before getting deep into blockchain cryptography let’s try to understand different cryptographic algorithms.
In symmetric key cryptography the same key is used for encryption and decryption of messages. Some famous algorithms include Advanced Encryption Standard (AES) and the Data Encryption Standard (DES).
In asymmetric-key cryptography different keys are used for encryption and decryption. The key which is used for encryption is called public key and the one used for decryption is called private key.
Some algorithms that use these keys are Rivest Shamir Adleman (RSA), Diffie-Hellman key agreement, Elliptic Curve Cryptography (ECC) and Digital Signature Algorithm (DSA).
In hashing, data is sent through a hashing function which as an output gives a unique hash. Basically it uses a cipher to generate the hash. Some hashing algorithms are MD5 and SHA-family. In blockchain SHA-256 algorithm is used.
Asymmetric key cryptography or public key cryptography is an important element in blockchain. It is used in Wallets and transitions. When a user opens an account on a wallet, they generate a public and private key. The address of the wallet which is nothing but the combination of numbers and letters is generated using a public key. Private key is used to prove ownership of a wallet.
The transition on blockchain is a message that is broadcasted on blockchain. The message says “ An amount of coin from my wallet is transferred to Y wallet”. Once the message is confirmed the transition is immutably written into the ledger, and balance is updated.
Public-key cryptography is also used in digital signature. Digital signatures are used to verify that the information put on the blockchain is correct.
Apart from public-key cryptography, Cryptographic hashing is another important technology used in blockchain. This technology is responsible for immutability in blockchain. Cryptographic hashing provides following advantages:
There is always going to be a unique hash for the given content. It doesn’t matter how many times you pass the same content from the hashing function, the hash for the given content will be the same. This is called deterministic property.
If the tiniest of the information is changed from the content, that hash function will generate a new hash which will be totally different from the previous hash. This property is called the avalanche effect.
It is impossible to determine the input data or content using hash. This property is called irreversibility.
No two different contents will have the same hash. This property is called collision resistance.
Hash functions also play a major role in linking the blocks to one another and maintaining the data integrity in the blockchain. This means, if suppose there are 99 blocks in the blockchain and the 100th block is added to the blockchain then the hash of the 100th block will contain all the information from previous 99 blocks. Similarly, the hash of the 99th block contains the information from the previous 98th block and so on. By traversing the hashes backwards, every block from 100 to 1 is linked by cryptographic hashing.
This makes the blockchain immutable. If someone in the blockchain tries to change even 1 bit of data in the block, this change will alter the hash of the block and all the blocks after it. Miners and nodes on the blockchain would immediately notice the resulting hashes don’t match their version of the chain and reject the change.
Three technologies namely hashing, public-key cryptography and digital signatures are used to secure the blockchain. Where Public-key encryption serves as the premise for blockchain wallets and transactions, cryptographic hash capabilities offer the trait of immutability and Digital signatures ensure the credibility of the information.
- The Code Book by Simon Singh.
Do follow our LinkedIn page for updates: [ Myraah IO on LinkedIn ]