Cryptography in Blockchain

Cryptography in Blockchain

PKI and hashing

Every household has its mystical language among family members. They use this secret language to communicate among themselves without anyone noticing. For example, at a party at a friend's place, the father scratches his nose to indicate that it is time to leave now. All family members assemble to say goodbye and leave. (agreed upon secretly among family members).

Internet is a public domain, whatever you put in this space is accessible to all and hence there is a need for something similar, to keep the exchange of information mystic. Cryptography can be thought of as a technology that enables each one of us mystically communicates with friends over the internet while hiding information from others.

Cryptography is the science of using mathematics to make the data unreadable unless you have the secret key to transfer it back to a readable state. Data in unreadable form is referred to as cryptic.

Encryption is the mechanism to transform readable data into cryptic and decrypt is the process to restore data as readable. The secret phrase is the key. Those who have it can participate in the communication and are part of the inner circle.

The biggest challenge was to share the key with members of the inner circle without anyone knowing about it.

Symmetric Key

A mechanism where the same key is used for encryption and decryption. The difference was in the process/algorithm that transformed the data. This worked fine as long as the key was in safe hands, but once it is exposed, there will be no inner circle after that.

Public/Private Keys

Problems of exchanging secret keys and vulnerabilities around that lead to public and private key encryption models. One key is known to all in the public and the private key is kept secretly and is never transmitted on public networks.

This approach brought two key aspects

a) Anyone can encrypt data using a public key, and such data can be decrypted using only a private key.[data transmission is safer]

b) if someone uses their private key to authorize, anyone using the public key can verify and identify the authorizer.

Hashing

Hashing can be compared to your fingerprint. Comparing two fingerprints, we can match and tell, they are of the same person, but not necessarily who that person was.[ignore the fingerprints database for now].

Hashing is an algorithm which can transform data of any size into a unique digest of fixed size. As long as the data is the same, the resulting digest is the same. If we keep a copy of this digest which is small in size, at any point in time, we can verify the underlying data by running it through the Hashing algorithm. If the results match, we can confirm it is the same data.

"Digest is representative of data like a fingerprint is to us". I find it easy to wrap this kind of comparison in my head.

Cryptographic algorithms are the pillars of the Blockchain.

Blockchain leverages Public/Private keys and Hashing to achieve its purpose as an immutable public ledger. These cryptographic functions are the foundation of the blockchain.

Public/Private Keys role in blockchain

Accounts in the blockchain use public and private keys for their functioning. Any change in blockchain storage can be kicked off by the holder of the private key only. Before the change is incorporated into the blockchain, the participants of the infrastructure will validate whether to accept or reject the change.

The change which is referred to as a transaction is accepted in a block and is linked to the previous block. These linked blocks form the blockchain.

Hashing function's role in Blockchain

Hashing ensures the links are held as long as the data in the previous block is not changed. It does this by checking the hash values of blocks formed along with links to previous blocks. As long as the Hash string matches, we can be assured that the data did not change and blockchain retains its immutable aspect.

A wealth of information at AuditOne

AuditOne has a repository of information that helped me through the journey to grasp some of these key concepts.

Please refer to the below link.

auditone.notion.site/auditone/bb52d390910e4..

To learn more about AuditOne, visit their website.

auditone.io

They also conduct quizzes and CTF challenges which help in verifying the progress, and also a great place to meet like-minded people. Join their discord channel to explore more.