Modern block ciphers
Contd.
Contd.
• Substitution cipher
• Transposition cipher
• To be resistant to exhaustive-search attack, a modern block cipher
needs to be designed as a substitution cipher
Example
• Suppose that we have a block cipher where n = 64. If there are 10 ones in
the ciphertext, how many trial-and-error tests does Eve need to do to
recover the plaintext from the intercepted ciphertext in each of the
following cases?
a. The cipher is designed as a substitution cipher.
b. The cipher is designed as a transposition cipher.
Ans:
a. Eve has no idea how many 1’s are in the plaintext. Try all possible 264 64-
bit blocks.
b. Eve knows that there are exactly ten 1’s in the plaintext. Eve can launch
an exhaustive-search attack using only those 64-bit blocks that have
exactly 10 1’s.
Block ciphers as permutation groups
Full size key transposition block ciphers
• Possible keys - n!
• Key - log 2 𝑛! bits
Example
• Show the model and the set of permutation tables for a 3-bit block
transposition cipher where the block size is 3 bits.
Full size key substitution block ciphers
• Substitutes bits.
• Model as a permutation if we can decode the input and encode the
output.
Example
• Show the model and the set of permutation tables for a 3-bit block
substitution cipher.
Contd.
• Permutation:
oA full-size key n-bit transposition cipher or a substitution block cipher
oDifferent key sizes
• Transposition: key - log 2 𝑛!
• Substitution: key - log 2 2𝑛 !
• A partial-key cipher is a group under the composition operation if it is
a subgroup of the corresponding full-size key cipher.
Modern block ciphers - components
P-boxes
Possible mappings of a 3 X 3 P box
Straight P- box
Example
• Design an 8 × 8 permutation table for a straight P-box that moves the
two middle bits (bits 4 and 5) in the input word to the two ends (bits
1 and 8) in the output words. Relative positions of other bits should
not be changed.
Ans:
Straight P-box with the table [4 1 2 3 6 7 8 5].
Compression P-boxes
• P-box with n inputs and m outputs where m < n.
32 X 24 permutation table
Expansion P-boxes
• P-box with n inputs and m outputs where m > n.
12 X 16 permutation table
Inverting permutation table
Non invertible compression and expansion P-boxes
S-box
• An m × n substitution unit, where m and n are not necessarily the
same.
• Linear S-box:
Example – nonlinear S-box
• No linear relationship between inputs and outputs
Input-output relationship for S-box of size 3 X 2
S box: Invertibility
• May or may not be invertible.
• Invertible S-box: number of input bits same as the number of output
bits.
Circular shifting
Swap operation
Split and combine
Product cipher
• Introduced by Shannon.
• Complex cipher combining substitution, permutation and other modern
block cipher components.
• Diffusion - hides the relationship between the ciphertext and the plaintext.
• Confusion - hides the relationship between the ciphertext and the key.
• Rounds - Diffusion and confusion can be achieved using iterated product
ciphers where each iteration is a combination of S-boxes, P-boxes, and
other components.
• Divided into 2 classes:
oFeistel ciphers
oNon-feistel ciphers
Product cipher
Diffusion and confusion in block cipher
Feistel cipher – First version
Improvement of previous Feistel design
Final design of
Fiestel cipher
with two rounds
Non-Feistel cipher
• Only invertible components.
• A component in the encryption cipher has the corresponding
component in the decryption cipher.
Modern stream ciphers
Contd.
Contd.
Modern stream ciphers
Synchronous stream ciphers Nonsynchronous stream ciphers
Key is independent of plaintext or ciphertext Key depends on plaintext or ciphertext
Algorithm modes
Algorithm modes
Electronic Code Cipher Block Cipher Output Feedback
Book (ECB) Chaining (CBC) Feedback (CFB) (OFB)
ECB mode – encryption process
ECB mode – decryption process
CBC mode – encryption process
CBC mode – decryption process
CFB mode
• Step – 1:
• Step – 2:
Contd.
• Step-3:
• Step 4:
Continue steps 1 to 3 till all plain text units are encrypted.
CFB mode – overall encryption process
OFB – overall encryption process
Counter (CTR) mode – encryption process
Counter (CTR) mode – decryption process
Data Encryption Standard (DES)
DES
• Symmetric-key block cipher
• Published by the National Institute of Standards and Technology
(NIST)
Basic principle
DES structure
Initial and final permutation steps in DES
Initial and final permutation tables
Round in DES (Encryption side)
DES Function
Expansion permutation
Expansion P-box table
S- boxes
S-box rule
S-box 1
Ex - The input to S-box 1 is 100011. What is the output?
Ans: 1100
Straight permutation table
Key generation
Parity drop table
Number of bit shifts
Key compression table