You are on page 1of 26

BLOCK CIPHERS

• Block cipher is an encryption and decryption method which operates on


the blocks(64 or 128 bit) of plain text, instead of operating on each bit of
plain text separately.
• Encryption is the process by which a readable message is converted to
an unreadable form to prevent unauthorized parties from reading it.
• Decryption is the process of converting an encrypted message back to
its original (readable) format.
• The original message is called the plaintext message (refer to anything
which humans can understand and/or relate to)
• The encrypted message is called the ciphertext message(a series of
randomized letters and numbers which humans cannot make any sense
of)
• Text Encryption is the method by which information is converted into
secret code that hides the information’s true meaning.
• Cipher is an algorithm which is applied to plain text to get cipher text.
• It is the unreadable output of an encryption algorithm.
Example :
Let: A-Z = 1–26 , a-z = 27–53 , !=ex, @= adr
Let the numbers from 1–100 be the same (no change in that)
“RAM” after encryption will be “18113”
“ram” will be “442739”
“@Ram13” will be “adr18273913”
• Block chipher is a Symmetric encryption algorithms (Private Key
Cryptography)
• A block cipher is an encryption algorithm that encrypts a fixed size of n-
bits of data - known as a block - at one time.
• The usual sizes of each block are 64 bits, 128 bits, and 256 bits.
• A block cipher encryption algorithm might take (for example) a 128-bit
block of plaintext as input, and output a corresponding 128-bit block of
ciphertext.
• If you want to encrypt “For the Alliance” using a block cipher, the
plaintext message would be broken down into smaller blocks of binary.
010001100110111101110010001000000111010001101000011001010010
000001000001011011000110110001101001011000010110111001100011
011001010010111
• Now, if we break these 136 binary digits into blocks of, say, 4 digits, it
divides well because 4 goes into 136 a total of 32 times.
Block Cipher Principles
• A block cipher is designed by considering its three critical aspects

Number of Design of Key Schedule


Rounds Function F Algorithm

1. Number of Rounds
• The number of rounds judges the strength of the block cipher algorithm.
• It is considered that more is the number of rounds, difficult is for
cryptanalysis to break the algorithm.
2. Design of function F
• Based on the Feistel structure, the entire encryption process consists of
multiple rounds of plain text processing – where the input block of each
round is denoted by two halves namely, L (for left half) and R (for right
half).
• Function F is essentially an encrypting function that takes in the
encryption key “K” and “R” as the inputs and produces the encrypted
output. It is the block cipher design principle that determines security.
3. Key schedule algorithm
• The key schedule algorithm calculates the round keys.
• This algorithm differs according to the block ciphering schemes or
methods.
• For example, the key schedule algorithm in the DES scheme divides the
56-bit key into two halves of 28-bit each.
Block Cipher Operation Modes
• There are five types of operations in block cipher modes

Operation Modes

Electronic Cipher Block Cipher Output


Counter
Codebook Chaining Feedback FeedBack
Mode
mode mode Model mode
(CTR)
(ECB) (CBC) (CFM) (OFB)
1. Electronic Codebook (ECB)
• This is considered to be the easiest block cipher mode of operation.
• In electronic codebook mode (ECB) the plain text is divided into the
blocks, each of 64-bit.
• Each block is encrypted one at a time to produce the cipher block.
• The same key is used to encrypt each block.
• The plaintext X is split into blocks x1,x2,…,xn whose size is exactly the same
as the size of the cipher block.
• Each block is then encrypted independently using the fixed key k
• When the receiver receives the message i.e. ciphertext.
• This ciphertext is again divided into blocks, each of 64-bit and each block is
decrypted independently one at a time to obtain the corresponding plain
text block.
• Here also the same key is used to decrypt each block which was used to
encrypt each block.
ECB Mode has a number of problems
• The first is due to the property that if mi = mj then we have ci = cj ,
– i.e. the same input block always generates the same output block.
– This is a problem since stereotyped beginnings and ends of messages
are common.
• The second problem comes because we could simply delete blocks from
the message and no one would know.
• Thirdly we could replay known blocks from other messages. By extracting
ciphertext corresponding to a known piece of plaintext we can then
amend other transactions to contain this known block of text.
• Suppose we obtained the encryption of the sentences
Pay Alice one hundred pounds, encrypted the horse has four legs,
Don’t pay Bob two hundred pounds stop the pony hasn’t four legs

• We can now make the recipient pay Alice two hundred pounds by
sending her the message
the horse hasn’t four legs
2. Cipher Block Chaining Mode (CBC)
• The CBC encryption mode was invented in IBM in 1976.
• This mode is about adding XOR each plaintext block to the ciphertext
block.
• The result is then encrypted using the cipher algorithm in the usual way.
• As a result, every subsequent ciphertext block depends on the previous
one.
• The first plaintext block is added XOR to a random initialization vector
(commonly referred to as IV).
• The vector has the same size as a plaintext block.
• The plaintext must first be divided into a series of blocks , p1,….,pn
• The encryption steps of CBC are
Step 1:
– The initialization vector and first plain text block are XORed and the
result of XOR is then encrypted using the key to obtain the first
ciphertext block.
Step 2:
– The first ciphertext block is fed to the encryption of the second plain
text block.
– For the encryption of second plain text block, first ciphertext block
and second plain text block is XORed and the result of XOR is
encrypted using the same key in step 1 to obtain the second
ciphertext block.
• Encryption is then performed via the equations
c1 = ek(p1 ⊕ IV ),
ci = ek(mi ⊕ cn−1) for i > 1,
s

• Similarly, the result of encryption of second plain text block i.e. the
second ciphertext block is fed to the encryption of third plain text block
to obtain third ciphertext block.
• And the process continues to obtain all the ciphertext blocks.
Decryption steps of CBC:
• Step 1:
– The first ciphertext block is decrypted using the same key that was
used for encrypting all plain text blocks.
– The result of decryption is then XORed with the initialization vector
(IV) to obtain the first plain text block.
• Step 2:
– The second ciphertext block is decrypted and the result of decryption
is XORed with the first ciphertext block to obtain the second plain
text block. And the process continues till all plain text blocks are
retrieved.
• Decryption also
requires the IV and is
performed via the
equations
p1 = dk(c1) ⊕ IV ,
pi = dk(ci) ⊕ ci−1 for i > 1,
3. Cipher Feedback Mode (CFB)
• This operational mode generates pseudorandom bits.
• It uses the ciphertext from the previous block in the chain (this is known
as feedback, hence the fitting name) and a cryptographic key to do this.
• Cipher feedback mode is used to operate on smaller units than blocks.
Encryption steps
• Step 1: The initialization vector, IV is kept in the shift register and it is
encrypted using the key.
• Step 2: The left most s bits of the encrypted IV is then XORed with the
first fragment of the plain text of s bits. It produces the first ciphertext C1
of s bits.
• Step 3: Now the shift register containing initialization vector performs left
shift by s bits and s bits C1 replaces the rightmost s bits of the
initialization vector.
• Then again, the encryption is performed on IV and the leftmost s bit of
encrypted IV is XORed with the second fragment of plain text to obtain s
bit ciphertext C2.
Decryption Steps:
• Step 1: The initialization vector is placed in the shift register. It is
encrypted using the same key.
• Step 2: The IV in the shift register is left-shifted by s bits and the s bits C1
replaces the rightmost s bits of IV.
4. Output Feedback Mode
• The output feedback (OFB) mode is almost similar to the CFB.
• The difference between CFB and OFB is that unlike CFB, in OFB the
encrypted IV is fed to the encryption of next plain text block.
• The other difference is that CFB operates on a stream of bits whereas OFB
operates on the block of bits.
• Steps for encryption:
• Step 1: The initialization vector is encrypted using the key.
• Step 2: The encrypted IV is then XORed with the plain text block to obtain
the ciphertext block.
• The encrypted IV is fed to the encryption of next plain text block
• Steps for decryption:
• Step 1: The initialization vector is encrypted using the same key used for
encrypting all plain text blocks.
• Note: In the decryption process also the encryption function is
implemented.
• Step2: The encrypted IV is then XORed with the ciphertext block to
retrieve the plain text block.
• The encrypted IV is also fed to the decryption process of the next
ciphertext block
5. Counter Mode
• It is similar to OFB but there is no feedback mechanism in counter mode.
• Nothing is being fed from the previous step to the next step instead it
uses a sequence of number which is termed as a counter which is input to
the encryption function along with the key.
• After a plain text block is encrypted the counter value increments by 1.
• Steps of encryption:
• Step1: The counter value is encrypted using a key.
• Step 2: The encrypted counter value is XORed with the plain text block to
obtain a ciphertext block.
• To encrypt the next subsequent plain text block the counter value is
incremented by 1 and step 1 and 2 are repeated to obtain the
corresponding ciphertext.
• Steps for decryption:
• Step1: The counter value is encrypted using a key.
• Note: Encryption function is used in the decryption process. The same
counter values are used for decryption as used while encryption.
• Step 2: The encrypted counter value is XORed with the ciphertext block
to obtain a plain text block.

• To decrypt the next subsequent ciphertext block the counter value is


incremented by 1 and step 1 and 2 are repeated to obtain corresponding
plain text.

You might also like