KEMBAR78
Chapter1 Blockchain Basicsf | PDF | Key (Cryptography) | Cryptography
0% found this document useful (0 votes)
31 views67 pages

Chapter1 Blockchain Basicsf

The document provides an introduction to Distributed Ledger Technology (DLT) and Blockchain, explaining the core concepts, history, and features of blockchain systems. It discusses the structure of blockchain, including elements like addresses, transactions, blocks, and nodes, as well as various consensus algorithms used to maintain the integrity of the ledger. Additionally, it categorizes different types of blockchains and contrasts distributed ledgers with blockchain technology.

Uploaded by

asavari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views67 pages

Chapter1 Blockchain Basicsf

The document provides an introduction to Distributed Ledger Technology (DLT) and Blockchain, explaining the core concepts, history, and features of blockchain systems. It discusses the structure of blockchain, including elements like addresses, transactions, blocks, and nodes, as well as various consensus algorithms used to maintain the integrity of the ledger. Additionally, it categorizes different types of blockchains and contrasts distributed ledgers with blockchain technology.

Uploaded by

asavari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Block chain & DLT

Chapter1:
Introduction to DLT and Blockchain
Dr. Trupti Lotlikar
Department of Information Technology
FR.CRIT, Vashi.
What is Blockchain?
“Blockchain at its core is a peer-to-peer ,distributed
ledger th at records transactions between two
parties that is cryptographically secure, append-only,
immutable (extremely hard to change), and updateable
only via consensus or agreement among peers.”
What is Blockchain?
Blockchain is a distributed ledger that …
➔ can contain financial and/or non-financ ial transactions.
➔ Contain a ledger that is replicated (distributed) across a numb er of systems
in near rea l-ti me over a p eer-to-p eer network.
➔ Every participant “ ow n s ” the same copy of the ledger and gets updates
when any transaction is added to the ledger.
➔ Every participant helps determine the intrinsic “immut abi lity” of all
exi stin g records.
➔ uses cryptography and digital signatures to prove identity, authenticity and
enforce read/write access rights.
➔ has mech ani sms to make it hard to chan ge historical records, or at least
make it easy to detect when someon e is trying to chan ge it.
Little History
➔ 1991 - Stuart Haber & W. Scott - cryptographical ly secured ch ain
of blocks.
➔ 1992 - Merkl e trees + cryptographical ly secured ch ain of blocks
➔ 200 4 - H al Finley - Reusable Pro of - of - wor k (RPoW) - Digital
cash
➔ 2008 - Satoshi Nakamoto - Bitcoin
➔ 2014 - Vitalik Buterin - Ethereum 1.0
➔ 2022 - Vitalik Buterin - Ethereum 2.0
• Blockchain can be thought of as a layer of a distributed peer-to-peer
network running on top of the Internet,

From a business point of


view a blockchain can be
defined as a platform
whereby peers can
exchange
values using transactions
without the need for a
central
trusted arbitrator.
The structure of a generic blockchain can be visualized with the help of the following
diagram:
Generic elements of a blockchain
• Addresses
• Transaction
• Block
• Peer to Peer network
• Smart Contracts
• Scripting or programming language
• Virtual Machnes
• State Machine
• Nodes
• ADDRESSES
• Addresses are unique identifiers that are used in a transaction on the blockchain
to denote senders and recipients.
• An address is usually a public key or derived from a public key.
• While addresses can be reused by the same user, addresses themselves are
unique.
• In practice, however, a single user may not use the same address again and
generate a new one for each transaction. This newly generated address will be
unique.
• As a good practice it is suggested that users generate a new address for each
transaction in order to avoid linking transactions to the common owner, thus
avoiding identification.
• TRANSACTION
• A transaction is the fundamental unit of a blockchain. A transaction represents a transfer of value from one
address to another.
• BLOCK
• A block is composed of multiple transactions and some other elements such as the previous block hash
(hash pointer), timestamp, and nonce.
Peer-to-peer network
➔ All the c om mu ni cat io ns (transactions) occur
directly between peers without a central entity.
➔ Each peer stores and forwards infor matio n to all
other peers.
➔ Advantages with P2P networks:
◆ Decentralization
◆ Hi g h Availability
◆ Im m u n e to Do S attacks
◆ N o censorship by central authorities
➔ E xa m ple s : Na ps te r, Bit to r ren t, S kype
• SCRIPTING OR PROGRAMMING LANGUAGE
• This element performs various operations on a transaction.
• Transaction scripts are predefined sets of commands for nodes to transfer
tokens from one address to another and perform various other functions
• Turing complete programming language is a desirable feature of blockchains;
• VIRTUAL MACHINE
• This is an extension of a transaction script.
• A virtual machine allows Turing complete code to be run on a blockchain (as
smart contracts) whereas a transaction script can be limited in its operation.
• Virtual machines are not available on all blockchains; however, various
blockchains use virtual machines to run programs, for example Ethereum
Virtual Machine (EVM) and Chain Virtual Machine (CVM).
• STATE MACHINE
• A blockchain can be viewed as a state transition mechanism whereby a state is modified
from its initial form to the next and eventually to a final form as a result of a transaction
execution and validation process by nodes.
• NODES
• A node in a blockchain network performs various functions depending on the role it takes.
• A node can propose and validate transactions and perform mining to facilitate consensus
and secure the blockchain.
• This is done by following a consensus protocol. (Most commonly this is PoW.)
• Nodes can also perform other functions such as simple payment verification (lightweight
nodes), validators, and many others functions depending on the type of the blockchain
used and the role assigned to the node.
• SMART CONTRACTS
• These programs run on top of the blockchain and encapsulate the
business logic to be executed when certain conditions are met.
• The smart contract feature is not available in all blockchains but is now
becoming a very desirable feature due to the flexibility and power it
• provides to the blockchain applications.
Features of a blockchain
• Distributed consensus
• Transaction verification
• Platforms for smart contracts
• Transferring value between peers
• Generating cryptocurrency
• Smart property
• Provider of security
• Immutability
• Uniqueness
• Smart contracts
• DISTRIBUTED CONSENSUS
• Distributed consensus is the major underpinning of a blockchain. This enables
a blockchain to present a single version of truth that is agreed upon by all
parties without the requirement of a central authority.
• TRANSACTION VERIFICATION
• Any transactions posted from nodes on the blockchain are verified based on a
predetermined set of rules and only valid transactions are selected for
inclusion in a block.
• PLATFORMS FOR SMART CONTRACTS
• A blockchain is a platform where programs can run that execute business
logic on behalf of the users.
• Not all blockchains have a mechanism to execute smart contracts; however,
this is now a very desirable feature.
ANSFERRING VALUE BETWEEN PEERS
ckchain enables the transfer of value between its users via tokens. Tokens can be thought of as a
rier of value.
NERATING CRYPTOCURRENCY
s is an optional feature depending on the type of blockchain used.
blockchain can generate cryptocurrency as an incentive to its miners who validate the transactions
d spend resources in order to secure the blockchain.
ART PROPERTY
the first time it is possible to link a digital or physical asset to the blockchain in an irrevocable
nner, such that it cannot be claimed by anyone else; you are in full control of your asset and it cannot
double spent or double owned.
mpare it with a digital music file, for example, which can be copied many times without any
ntrol; on a blockchain, however, if you own it no one else can claim it unless you decide to transfer it
someone. This feature has far-reaching implications especially in Digital Rights Management (DRM)
d electronic cash systems where double spend detection is a key requirement.
e double spend problem was first solved in bitcoin.
• PROVIDER OF SECURITY
• Blockchain is based on proven cryptographic technology that ensures the integrity
and availability of data.
• Generally, confidentiality is not provided due to the requirements of transparency.
• This has become a main barrier for its adaptability by financial institutions and
other industries that need privacy and confidentiality of transactions. As such it is
being researched very actively and there is already some good progress made.
• Other security services such as nonrepudiation and authentication are also
provided by blockchain as all actions are secured by using private keys and digital
signatures.
• IMMUTABILITY
• This is another key feature of blockchain: records once added onto the blockchain are immutable.
• There is the possibility of rolling back the changes but this is considered almost impossible to do as it
will require an unaffordable amount of computing resources. For example, in much desirable case of
bitcoin if a malicious user wants to alter the previous blocks then it would. require computing the PoW
again for all those blocks that have already been added to the blockchain. This difficulty makes the
records on a blockchain practically immutable.
• UNIQUENESS
• This feature of blockchain ensures that every transaction is unique and has not been spent already. This
is especially relevant in cryptocurrencies where much desirable detection and avoidance of double
spending are a key requirement.
• SMART CONTRACTS
• These are automated autonomous programs that reside on the blockchain and encapsulate business
logic and code in order to execute a required function when certain conditions are met.
Types of Blockchain
• Public blockchains
• These blockchains are open to the public and anyone can participate as a node in
the decision-making process.
• Users may or may not be rewarded for their participation.
• These ledgers are not owned by anyone and are publicly open for anyone to
participate in.
• All users of the permission-less ledger maintain a copy of the ledger on their local
nodes and use a distributed consensus mechanism in order to reach a decision
about the eventual state of the ledger.
• These blockchains are also known as permission-less ledgers.
• Private blockchains
• Private blockchains as the name implies are private and are open only to a
consortium or group of individuals or organizations that has decided to share the
ledger among themselves.
• Semi-private blockchains
.
• Here part of the blockchain is private and part of it is public.
• The private part is controlled by a group of individuals whereas the public part is
open for participation by anyone.
• Sidechains
• More precisely known as pegged sidechains, this is a concept whereby coins can
be moved from one blockchain to another and moved back.
• Common uses include the creation of new altcoins (alternative cryptocurrencies)
whereby coins are burnt as a proof of adequate stake. There are two types of
sidechain.
• The example provided above for burning coins is applicable to a one-way pegged
sidechain.
• The second type is called a two-way pegged sidechain, which allows the
movement of coins from the main chain to the sidechain and back to the main
chain when required.
• Permissioned ledger
• A permissioned ledger is a blockchain whereby the participants of the network are
known and already trusted.
• Permissioned ledgers do not need to use a distributed consensus mechanism,
instead an agreement protocol can be used to maintain a shared version of truth
about the state of the records on the blockchain.
• There is also no requirement for a permissioned blockchain to be private as it can
be a public blockchain but with regulated access control.
• Distributed ledger
• As the name suggests, this ledger is distributed among its participants and spread
across multiple sites or organizations. This type can either be private or public.
• The key idea is that, unlike many other blockchains, the records are stored
contiguously instead of sorted into blocks. epartments.
• Shared ledger
• This is generic term that is used to describe any application or database that
is shared by the public or a consortium.
• Fully private and proprietary blockchains
• These blockchains perhaps have no mainstream application as they deviate
from the core idea of decentralization in blockchain technology.
• Nonetheless in specific private settings within an organization there might be
a need to share data and provide some level of guarantee of the authenticity
of the data.
• These blockchains could be useful in that scenario. For example, for
collaboration and sharing data between various government departments
• Tokenized blockchains
• These blockchains are standard blockchains that generate cryptocurrency as a
result of a consensus process via mining or via initial distribution.
• Tokenless blockchains
• These are probably not real blockchains because they lack the basic unit of
transfer of value but are still valuable in situations where there is no need to
transfer value between nodes and only sharing some data among various
already trusted parties is required.
Distributed ledger
➔ A distributed ledger can be described as a ledger of any
transacti ons or contracts mai ntained in a decentralized for m
across different locations and peers.
➔ Every peer in the network h as access to information stored at
the distributed ledger, and no single peer can control the data
stored at the ledger.
Distributed ledger vs Blockchain
➔ Distributed ledgers ca n be of m any ty pes and Blockchai n is a specific
ty pe of distributed ledger.
➔ A Blockchai n distributed ledger is mai nta ined as a set of b locks, such
that each block is cry ptographically chained to its parent block (except
fir st block).
Blockchain vs blockchain (ledger)
➔ I n genera l, to differenti ate between the distributed ledger in Blockchai n
and the whole Blockchai n technolo gy, the following te rmi nolog y is used
◆ b lockchain - represents distributed ledger in Blockchai n
◆ Blockchai n - N etwor k + ledger + consensus
Consensus algorithm
➔ If all the peers have their own copy of ledger, how do they all
have the s ame copy of the ledger?
➔ In Blockch ai n, a secure consensus algorith m is executed by a set
of decentralized peers know n as miners to agree on a common
global state of the distributed ledger.
➔ Consensus algorithm also guarantees the security of the ledger
Consensus is the backbone of a blockchain and provides decentralization of
control as a result through an optional process known as mining.
The choice of consensus algorithm is also governed by the type of blockchain in
use. Not all consensus mechanisms are suitable for all types of blockchains.
For example, in public permissionless blockchains it would make sense to use
PoW
➔ .
Consensus algorithms examples
Roughly, the following two categories of consensus mechanism exist:
1. Proof-based, leader-based, or the Nakamoto consensus whereby a leader is elected
and proposes a final value
2. Byzantine fault tolerance-based, which is a more traditional approach based on
rounds of votes
• Consensus Algorithms

PROOF OF WORK
This type of consensus mechanism relies on proof that enough computational
resources have been spent before proposing a value for acceptance by the network.
This is used in bitcoin and other cryptocurrencies.
• .

• PROOF OF STAKE
• This algorithm works on the idea that a node or user has enough stake in the system;
for example the user has invested enough in the system so that any malicious attempt
would outweigh the benefits of performing an attack on the system. This idea was first
introduced by Peercoin and is going to be used in the Ethereum blockchain.
• Another important concept in Proof of Stake (PoS) is coin age, which is a derived from
the amount of time and the number of coins that have not been spent.
• In this model, the chances of proposing and signing the next block increase with the
coin age
• DELEGATED PROOF OF STAKE
• Delegated Proof of Stake (DPOS) is an innovation over standard PoS whereby each
node that has stake in the system can delegate the validation of a transaction to other
nodes by voting. This is used in the bitshares blockchain.
• PROOF OF ELAPSED TIME
• Introduced by Intel, it uses Trusted Execution Environment (TEE) to provide
randomness and safety in the leader election process via a guaranteed wait time.
• .DEPOSIT-BASED CONSENSUS
• Nodes that wish to participate on the network have to put in a security deposit
before they can propose a block.
• PROOF OF IMPORTANCE
• This idea is important and different from Proof of Stake.
• Proof of importance not only relies on how much stake a user has in the system
but it also monitors the usage and movement of tokens by the user to establish a
level of trust and importance. This is used in Nemcoin.
• FEDERATED CONSENSUS OR FEDERATED BYZANTINE CONSENSUS
• Used in the stellar consensus protocol, nodes in this protocol keep a group of publicly
trusted peers and propagates only those transactions that have been validated by the
majority of trusted nodes.
• REPUTATION-BASED MECHANISMS
• As the name suggests, a leader is elected on the basis of the reputation it has built
over time on the network.
• This can be based on the voting from other members.
• PRACTICAL BYZANTINE FAULT TOLERANCE
• Practical Byzantine Fault Tolerance (PBFT) achieves state machine replication, which
provides tolerance against Byzantine nodes.
Proof-of-work
➔ In PoW, a computer is required to solve a computational problem of a
predetermined level of difficulty.
➔ In Bitcoin Pow, a miner has to fi nd a nonce su ch that the has h of a
block is less than s om e predetermined value.
➔ The predetermined value is called as target. Target is a 2 56 -bit
nu mb er. Lower the target value, dif ficul t it is to produce new block .
➔ It ’s like a lottery. You will win if your ticket nu mber is less than s om e
value.
➔ H ere, a miner is allowed to produce a new block, if he can generate the
has h of the block less than the target.
➔ Formally: G(nonce,H({blockHeader}/nonce)) < target. G and H are
2 56 -bit has h fun ctions.
➔ Nonce is al so a 2 56 -bit nu mb er. By varying the nonce for m 1to 2 256 a
miner has to fi nd the has h
Proof of work example
➔ Let the nonce is 4 - b it s i.e, nonc e has values 0-15.
➔ Let G and H outpu ts the has h of 4 bits.
➔ Let target is al so 4 bits.
➔ Let the current target is 1100
➔ Let the H({blockH eader}/nonce) = 1001
➔ Th en we have to fi nd a nonce su ch that H(nonce,1001)<1100
◆ Now H can output 0000,0001,0010,0011,0101,0110,0111,1000,1001
◆ Probability of fi nding the nonce is 9/16
➔ Let increase the difficulty by lowering the target. Let the new target is
0011.
◆ Now H can output 0000,0001,0010
◆ Probability of fi nding the nonce is 3/16
Disadvantages of Proof-of-Work
➔ PoW is a compu tation heavy algorithm.
➔ The search space is 2 256 , mean ing that in the wors t-cas e scenario,
that is for the lowest target, a miner has to perform 2 256 has h
operations.
➔ Due to large nu mber of comp utation s, a lot of power (current) is
wasted in fin d ing the nonce.
➔ M any miners will compete to produce a new block , but only one will
succeed. Thereby wastin g all the power.
➔ 51% attack
Proof-of-Stake
➔ I n PoS, the miner/validator is selected based on the stake he is
havi ng rather than com peti ng to solve a computati onal probl em .
➔ There are multiple variations of PoS:
◆ C oi n-age based PoS
◆ Ran do m-stake based PoS
◆ Fixed-stake based PoS (Ethereum 2.0 PoS)
◆ DPoS
Putting it all together
1. Pe rson A want to transfer 10 E TH to Pe rson B
2. Pe rson A cre ates a transact ion
3. With the he lp of his wallet , person A, si gns the transact ion and sends the node s to a
remote node.
4. If remote node is full node , it verifies that transact ion and broadc ast it. Ot herwise, it will
sim ply broadc ast the transa ction.
5. All the re ceiving node s verifies the transact ion and add it to buffe r called m em poo l /
transact ion pool.
6. All the mining/va lidator node try to produce the next block in the ledge r, which m ay
have A’s transa ction.
7. One of the m ini ng node will suc ceed in produc ing a new block co nt aining A’s
transa ction.
8. T hen , the new block is broadc ast to the network. All the re ceiving node s verify the b lock,
if block is valid, t he n they add the new block to their local copy of blo ckc ha in and
co nt inue to co mpete for produc ing the next block.
9. Pe rson A’s wallet will show transact ion c onfi rma ti on me ss ag e and updates the ba lanc e.
Benefits of a Blockchain system
➔ Decentralization
This is a core concept and benefit of blockchain. There is,no need for a trusted third
party or intermediary to validate transactions; instead a consensus mechanism is
used to agree on the validity of transactions
➔ Immu tab ili ty
Once the data has been written to the blockchain, it is extremely difficult to change it
back.
➢ Trans parency
As blockchains are shared and everyone can see what is on the blockchain, this allows
the system to be transparent and as a result trust is established. This is more relevant
in scenarios such as the disbursement of funds or benefits where personal discretion
should be restricted.
➢ High availability
• As the system is based on thousands of nodes in a peer to- peer network, and the data is
replicated and updated on each and every node, the system becomes highly available.
• Even if nodes leave the network or become inaccessible, the network as a whole
continues to work, thus making it highly available.
➢ Highly secure
• All transactions on a blockchain are cryptographically secured and provide integrity.
➢ Simplification of current paradigms
• The current model in many industries such as finance or health is rather disorganized,
wherein multiple entities maintain their own databases and data sharing can become very
difficult due to the disparate nature of the systems.
• But as a blockchain can serve as a single shared ledger among interested parties, this can
result in simplifying this model by reducing the complexity of managing the separate
systems maintained by each entity.
➢Faster dealings
• In the financial industry, especially in post-trade settlement functions,
blockchain can play a vital role by allowing the quicker settlement of trades as
it does not require a lengthy process of verification, reconciliation,and
clearance because a single version of agreed upondata is already available on
a shared ledger between financial organizations.
➢Cost saving
• As no third party or clearing houses are required in the blockchain model, this
can massively eliminate overhead costs in the form of fees that are paid to
clearing houses or trusted third parties.
Block
structure
➔ A Bl ock contains :
◆ Header
● H ash of the previous Block
● Merkle hash of the transactions
● Consensus information
◆ Body
● Contains transactions
● Block structure
➔ Bitcoin Bl ock structure
◆ https://blockstream.info/
➔ Ethereum Bl ock structure
◆ https://etherscan.io/
Genesis
Block
➔ Genesis = > First
➔ The genesis block of Bitcoin is as foll ows:
https://blockstream.info/block/000000000019d6689c085ae1658
31e934ff 763ae46a2a6c172b3f1b60a8ce26f ?expand
“The Times 03/Jan/2009 Chancellor on brink of second bailout for banks”.

➔ The genesis block of Ethereum is as foll ows:

https://etherscan.io/block/0
• Cryptographic primitives
• Cryptographic primitives are. the basic building blocks of
a security protocol or system.
• A security protocol is a set of steps taken inorder to
achieve required security goals by utilizing appropriate
security mechanisms.
• Various types of security protocols are in use, such as
authentication protocols, non-repudiation protocols,
and key management protocols.
• A generic cryptography model is shown in the following diagram:

• .A model showing the generic encryption and decryption model


• In the preceding diagram, P, E, C, and D represents
• Plain text, Encryption, Cipher text, and Decryption,respectively
• Entity: It is either a person or a system that sends, receives,
or performs operations on data
• Sender: Sender is an entity that transmits the data
• Receiver: Receiver is an entity that takes delivery of the data
• Adversary: This is an entity that tries to circumvent the
• security service
• Key: A key is some data that is used to encrypt or decrypt
• data
• Channel: Channel provides a medium of communication
• Between entities
• Cryptography is mainly divided into two categories, namely symmetric and asymmetric
cryptography
• Symmetric cryptography
• Symmetric cryptography refers to a type of cryptography whereby the key that is used to
encrypt the data is the same for decrypting the data, and thus it is also known as a shared key
cryptography.
• The key must be established or agreed on before the data exchange between the
communicating parties. This is the reason it is also called secret key cryptography.
• There are two types of symmetric ciphers, stream ciphers and block ciphers.
• Data Encryption Standard (DES) and Advanced Encryption Standard (AES) are
• common examples of block ciphers, whereas RC4 and A5 are commonly used stream ciphers .
STREAM CIPHERS
• These ciphers are encryption algorithms that apply encryption algorithms on a bit-by-bit
basis to plain textusing a key stream.
• There are two types of streamciphers: synchronous and asynchronous. A synchronous
stream cipher is a stream cipher, in which the keystream is generated
independently of the plaintext and of the ciphertext. The keystream is usually
produced by a pseudorandom generator, parameterized by a key, which is the
secret key of the whole scheme., whereas asynchronous stream ciphers have a key
stream that is also dependent on the encrypted data.
• In stream ciphers, encryption and decryption are basically the same function because they
are simple modulo 2 additions or XOR operation.
• The key requirement in stream ciphers
• is the security and randomness of key
• streams.
BLOCK CIPHERS

These are encryption algorithms that break up a text to be encrypted
(plain text) into blocks of fixed length and apply encryption block by
block.
• Block ciphers are usually built using a design strategy known as Fiestel
cipher. Recent block ciphers, such as AES have been built using a
combination of substitution and permutation called substitution-
permutation network (SPN).

Fiestel ciphers are based on the Fiestel network, which is a structure
developed by Horst Fiestel. This structure is based on the idea of
combining multiple rounds of repeated operations to achieve desirable
cryptographic properties knows as confusion and diffusion.
• Fiestel networks operate by dividing data into two blocks (left and
right) and process these blocks via keyed round functions.
:
•The input block to each round is divided into
two halves that can be denoted as L and R
for the left half and the right half.
•In each round, the right half of the block, R,
goes through unchanged. But the left half, L,
goes through an operation that depends on R
and the encryption key. First, we apply an
encrypting function ‘f’ that takes two input −
the key K and R. The function produces the
output f(R,K). Then, we XOR the output of
the mathematical function with L.
•Each round uses a different key, although all
these subkeys are related to the original key.
•The permutation step at the end of each
round swaps the modified L and unmodified
R. Therefore, the L for the next round would
be R of the current round. And R for the next
round be the output L of the current round.
•Above substitution and permutation steps
form a ‘round’.
• Block encryption mode
• In this mode, plaintext is divided into blocks of fixed length depending on the type
of cipher used and then the encryption function is applied on each block.
• Keystream generation modes
• In this mode, the encryption function generates a keystream that is then XORed
with the plaintext stream in order to achieve encryption.
• Message authentication modes
• In this mode, a message authentication code is computed as a result of an
encryption function.
• MAC is basically a cryptographic checksum that provides an integrity service.
• Cryptographic hashes
• Hash functions are basically used to compress a message to a fixed
length digest. In this mode, block ciphers are used as a compression
function to produce a hash of plain text.
• The most common block encryption modes are discussed briefly.
• Electronic code book
• This is a basic mode of operation in which the encrypted data is produced as a result of
applying the encryption algorithm one by one separately to each block of plain text. This is
the simplest mode but should not be used in practice as it is insecure and can reveal
information:
• Electronic code book mode for block ciphers
• Cipher block chaining
• In this mode, each block of plain text is XORed with the previous
encrypted block. The CBC mode uses initialization vector IV to encrypt
the first block. It is recommended that IV be randomly chosen:

• Cipher block chaining mode


• Counter mode
• The CTR mode effectively uses a block cipher as a stream cipher. In this
case, a unique nonce is supplied that is concatenated with the counter
value in order to produce a key stream:
Advanced Encryption Standard (AES)
• In 2001, after an open competition, an encryption algorithm named Rijndael that was
invented by cryptographers Joan Daemen and Vincent Rijmen was standardized as AES with
minor modifications by NIST in 2001. So far, no attack has been found against AES that is
better than the brute force method.
• Original Rijndael allows different key and block sizes of 128-bit, 192-bit,m and 256-bits, but
in the AES standard, only a 128-bit block size is allowed. However, key sizes of 128-bit, 192-
bit, and 256-bit are allowed.
• AES STEPS
• During the AES Algorithm processing, a 4 by 4 array of
• bytes knows as state is modified using multiple rounds.
• Full encryption requires 10 to 14 rounds depending on the size of the key. The following
table shows the key sizes and the required number of rounds
• Data Encryption Standard (DES)
.
• DES was introduced by the US National Institute of Standards and Technology (NIST) as a
standard algorithm for encryption and was in main use during 1980s and 1990s, but it has
been not proven to be very resistant against brute force attacks, due to advances in
• technology and cryptography research. Especially in July 1998, Electronic Frontier Foundation
(EFF) broke DES using a special purpose machine.
• DES uses a key of only 56 bits, which has raised some concerns.
• This problem was addressed with the introduction of Triple DES (3DES), which proposed the
usage of a 168-bit key using three 56-bit keys and the same number of executions of the DES
algorithm, thus making brute force attacks almost impossible.
• But other limitations, such as slow performance and 64-bit block size, are not desirable.
• Once the state is initialized with the input to the cipher, four operations are performed in four stages in
order to encrypt the input. These stages are AddRoundKey, SubBytes, ShiftRows, and MixColumns:
.
• 1. In the AddRoundKey step, the state array is XORed with a subkey, which is derived from the master key.
• 2. This is the substitution step where a lookup table (S-box) is used to replace all bytes of the state array.
• 3. This step is used to shift each row except the first one in the state array to the left in a cyclic and
incremental manner.
• 4. Finally, all bytes are mixed in this step in a linear fashion
• column-wise.
• The preceding steps describe one round of AES.
• In the final round (either 10, 12, or 14 depending on the key size),
• stage 4 is replaced with Addroundkey to ensure that the first
• three steps cannot be simply inverted back:
Asymmetric cryptography
• Asymmetric cryptography refers to a type of cryptography whereby the key that is used to
encrypt the data is different from the key that is used to decrypt the data. Also known as
public key cryptography, it uses public and private keys in order to encrypt and decrypt
• data, respectively.
• Various asymmetric cryptography schemes are in use, such as RSA, DSA, and El-Gammal.
• An overview of public key cryptography is shown in the following diagram:
The diagram explains how a sender encrypts the data
using a recipient's public key and is then transmitted
over the network to the receiver. Once it reaches the
receiver, it can be decrypted using the receiver's
private key.
This way, the private key remains on the receiver’s
side and there is no need to share keys in order
toperform encryption and decryption, which is the
case with symmetric encryption.
• Another diagram shows how public key cryptography
• can be used to verify the integrity of the received
• message by the receiver.
• In this model, the sender signs the data using their private key and transmits the
• message across to the receiver.
• Once the message is received on the receiver's side, it can be verified for its
• integrity by the sender's public key.
• Note that there is no encryption being performed in this model. This model is
• only used for message authentication and validation
• purposes:
• Security mechanisms offered by public key cryptosystem
• include key establishment, digital signatures, identification, encryption, and decryption.
• Key establishment mechanisms are concerned with the design of protocols that allow setting
up of keys over an insecure channel.
Qui
z
➔ H ow Bl ockchain solves Double spending attack?
◆ Let us assume a person A try to spend same amo unt of mo ney by sending it to
two different persons. A - > B and A - > C are the two transactions. No w, a min ing
node migh t receive both or only one transaction.
● If a min ing node receives both:
○ H e chooses one of the transactio ns, executes the transaction and
rejects the second transaction as it is a double spending transaction.
● If a min ing node receives only one transaction. H e includes that in a block and
pro pagates the block. All other min ing nodes, receives the block, re-
executes the transaction. No w, if any other min ing nodes receive the second
transactio n, they will simply discard it. Because, they already have the fir st
transaction recorded.
➔ What is the purpose of proof-of-work algorithm?
◆ It is a leader election algorithm. The person so lving the PoW, gets the rights
to produce next block.
➔ What is 51% attac k.
◆ If an attacker gets 51% of the hashin g power in the network, he can produce
blocks faster than rest of the network, there by jeopardizing the security of the
Blockchain.

You might also like