How do Hash and Encryption Helps in Blockchain

13
How do Hash and Encryption Helps in Blockchain blockchainexpert.uk

description

The main pillars on which blockchain is working are DLT(Distributed Ledger Technology), mechanism design, and the cryptographic algorithms. The collaborative work of these three technologies brings a secure, peer-to-peer exchange that would eliminate the need for a third party in the transaction of digital information.

Transcript of How do Hash and Encryption Helps in Blockchain

Page 1: How do Hash and Encryption Helps in Blockchain

How do Hash and Encryption Helps in Blockchain

blockchainexpert.uk

Page 2: How do Hash and Encryption Helps in Blockchain

INTRODUCTIONThe main pillars on which blockchain is working are DLT(Distributed Ledger Technology), mechanism

design, and the cryptographic algorithms. The collaborative work of these three technologies brings a

secure, peer-to-peer exchange that would eliminate the need for a third party in the transaction of digital

information.

What is exactly cryptography?

Cryptography is a protocol that prevents the third party from accessing the information or data of

the user. Using this technique secure communication of data is ensured.

Today's cryptography combines many fields and areas of computer science, Physics, Maths and

many more. The prefix ‘crypto’ means ‘hidden’ and ‘graphy’ means writing. Basically plaintext which is

human-readable data is encrypted with a special encryption algorithm. On applying decryption data is

decrypted to plain text.

Page 3: How do Hash and Encryption Helps in Blockchain
Page 4: How do Hash and Encryption Helps in Blockchain

Key terms

Encryption: The process which helps the data to transform into an unreadable format.

Decryption: This process helps in reversing the encrypted message into its original format.

Cipher: Encryption and decryption performing algorithms with well-defined steps.

Blockchain uses cryptography in many special ways for example in transaction areas, wallets,

network security. Ciphers or crypto algorithms are used to encrypt and decrypt plain text and used

mainly among computer and mobile devices to securely transmit information and data.

Public-key cryptography, hashing, and Merkle trees include the Cryptography technology which in turn

covers blockchain technology.

Public-Key Cryptography

Asymmetric Cryptography or public-key cryptography uses key pairs - a public key and private key.

Private keys are owned and operated by the owner itself and public keys are widely distributed.

Page 5: How do Hash and Encryption Helps in Blockchain

Keys are generated in pairs means each public key must have a private key. Mostly public-key is used for

encrypting messages which will lead securely transfer messages between computers and other devices

through the network securely. Whoever owns the public key can encrypt a message, but only those who

own a private key are able to decrypt that message.

Public-key cryptography is used mainly for message encryption between two parties or computers in a

secure way. The public key is distributed to anyone and with that public key, they can encrypt a message,

once encrypted, the only way to decrypt that message is by using the corresponding private key.

For example, take two users Alice and Bob. Suppose Alice wants to send a message to Bob and in an

encrypted way.

Alice encrypted message with Bob’s Public Key

For example: Suppose Alice wants to send a message to Bob and uses an encryption method. It would

work like this:

Page 6: How do Hash and Encryption Helps in Blockchain

1. Alice uses Bob’s public key to encrypt the message and also add a digital signature with Alice’s

private key and send a message to Bob.

2. Bob uses the private key to decrypt the message and also checks authentication with Alice’s public

key.

3. In case anyone tries to access the message in between, they may not be able to read the message,

they were only able to see some characters and numbers.

Public key cryptography is the most prominent blockchain technology which is used in wallets and

transactions for more security and reliability. For example, when a user is creating an account in a wallet

they are creating key pairs. In a transaction primarily a message is broadcasted that just has information,

says an X Cryptocurrency from one wallet and credits X coins into another wallet. Transactions written

into ledger and balances get updated.

Page 7: How do Hash and Encryption Helps in Blockchain
Page 8: How do Hash and Encryption Helps in Blockchain

Transaction message needs a signature from the private key from the sender wallet to be valid. After

anyone can use that wallet’s public key to ensure the digital signature coming from the private key is

authentic. This is one of the main role block validators before they are added to any transaction to the

blockchain.

Hashing

Hashing is another fundamental part of the blockchain and it helps to create a highly secure immutable

ledger which is the backbone of blockchain. Hashing in simple terms means taking any amount of input

or any size and returning a fixed length of different numbers and characters to form a string. A

cryptographic hash function can be termed as a special class of hash function with certain properties

like,

Irreversible: Hashed data cannot be reversible and it's impossible to determine the original data from

output hash.

Deterministic: The result of hashing the data must be the same no matter how many times this hashing

process continues.

Page 9: How do Hash and Encryption Helps in Blockchain

Collision Resistance: Different data can never have the same output.

Puzzle-friendly: A hash function should be puzzle friendly, which means that there is no short-cut to

find a desired output hash value. The only way to work around it should be by trying out different input

data combinations.

Blockchain immutability is created with cryptographic hash by creating a new block that contains the

hash of the previous block. Suppose a blockchain wants to add a new block, say 100th block. The 100th

block now has the data from the 99th block in hash format, and the 99th block contains the hash of the

98th block. This means each block contains the data of the previous block and also the data of that

block. If one block changed we need to change the data and hash of the entire chain. Technical wise

that is very difficult and impossible.

By changing the hashes backward, every block from 100 to 1 is linked by hashing. A diagram of this

architecture is shown below:

Page 10: How do Hash and Encryption Helps in Blockchain
Page 11: How do Hash and Encryption Helps in Blockchain

There are many hashing algorithms available like SHA-2, MD5, SHA-256, SHA-512. Bitcoin uses SHA-256

algorithm and Ethereum uses keccak256.

Merkle trees.

Merkle Tree is a hash tree which was created using a cryptographic hash function that stores raw data in

each node. Here each leaf node is the hash function of the original data and each child node is again

hashed and moved to the parent node.

Please click on the link to read more on Merkle Tree

Page 12: How do Hash and Encryption Helps in Blockchain

Read more : How do Hash and Encryption Helps in Blockchain

Page 13: How do Hash and Encryption Helps in Blockchain

Cybrosys LimitedAlpha House,100 Borough High Street,London, Greater LondonSE1 1LB, United Kingdom

Thank You !

[email protected]

Mail UsUK Phone

+44 7414439281