Block Ciphers
Block Ciphers
Block cipher
Stream Ciphers
Encrypts a digital data stream one bit or one byte at a time
One time pad is example; but has practical limitations
Typical approach for stream cipher:
Key (K) used as input to bit-stream generator algorithm
Algorithm generates cryptographic bit stream (ki ) used to
encrypt plaintext
Users share a key; use it to generate keystream
as K15=10 01 00 11
Ideal : n-bit block, 2n Mappings.
Total n. 2n mappings
11
Diffusion and Confusion
Diffusion
Dissipates statistical structure of plaintext over bulk of ciphertext
E.g. a plaintext letter affects the value of many ciphertext letters
How: repeatedly apply permutation (transposition) to data, and then apply
function
Confusion
Makes relationship between ciphertext and key as complex as possible even if
attacker can find some statistical characteristics of ciphertext, hard to
find key
mod 26
13
Confusion
14
Components of a Modern Block Cipher
P-Boxes
15
Continued
16
Continued
Example
17
Continued
Straight P-Boxes
5.18
Continued
Example
Solution
5.19
Continued
Compression P-Boxes
5.20
Expansion P-Box Continued
5.21
P-Boxes: Invertibility Continued
5.22
Continued
Example
5.23
Continued
5.24
Continued
S-Box
An S-box (substitution box) can be thought of as a
miniature substitution cipher.
5.25
Continued
Example
5.26
Continued
Example
5.27
Continued
Example
Based on the table, an input of 010 yields the output 01. An input of
101 yields the output of 00.
5.28
Continued
Example
5.30
Continued
Exclusive-Or
5.31
Continued
Exclusive-Or (Continued)
5.32
Continued
Figure Invertibility of the exclusive-or operation
5.34
Continued
Circular Shift
5.35
Continued
Swap
5.36
Split and Combine Continued
Two other operations found in some block ciphers are split and combine.
5.37
Continued
5.38
Product Ciphers
5.39
Continued
Diffusion
The idea of diffusion is to hide the relationship between the
ciphertext and the plaintext.
5.40
Continued
Confusion
The idea of confusion is to hide the relationship between the
ciphertext and the key.
5.41
Continued
Rounds
5.42
Continued
Figure A product cipher made of two rounds
5.43
Continued
Figure Diffusion and confusion in a block cipher
5.44
Two Classes of Product Ciphers
Modern block ciphers are all product ciphers, but they are
divided into two classes.
1. Feistel ciphers
2. Non-Feistel ciphers
45
Two Classes of Product Ciphers (cont.)
Feistel Ciphers
46
Continued
Example
The plaintext and ciphertext are each 4 bits long and the key is 3 bits
long. Assume that the function takes the first and third bits of the key,
interprets these two bits as a decimal number, squares the number,
and interprets the result as a 4-bit binary pattern. Show the results of
encryption and decryption if the original plaintext is 0111 and the key is
101.
Solution
The function extracts the first and third bits to get 11 in binary or 3 in decimal.
The result of squaring is 9, which is 1001 in binary.
Continued
50
Two algorithms are inverses of each other:
If L3=L2 and R3=R2
The final design of Feistel cipher Continued
Final
design
Flaw: no
change in
Right half.
Inc: rounds
Add:
swapper
52
Two algorithms are inverses of each other:
If L6=L1 and R6=R1 assuming that
L4=L3 and R4=R3
54
Feistel Structure for Block Ciphers
56
Using the Feistel Structure
Exact implementation depends on various design features
Block size, e.g. 64, 128 bits: larger values leads to more
diusion
Key size, e.g. 128 bits: larger values leads to more confusion,
resistance against brute force
Number of rounds, e.g. 16 rounds
Subkey generation algorithm: should be complex
Round function F: should be complex
58
Feistel Cipher Structure Decryption
59
General Formula for Encryption/Decryption
60
Relation between output and input
Show that the output of the first round of the
decryption process is equal to a 32-bit swap
of the input to the sixteenth round of the
encryption process.
consider the encryption
decryption side
Thus, we have
Therefore, the output of the first round
of the decryption process is , which
is the 32-bit swap of the input to the sixteenth
round of the encryption
61
Feistel Cipher Design Elements Discussions
Block size
Larger block sizes mean greater security
Key size
Larger key size means greater security but may decrease
encryption/decryption speed
Number of rounds
a single round offers inadequate security but that multiple
rounds offer increasing security
Subkey generation algorithm
Greater complexity leads to greater difficulty of cryptanalysis
Round function
Same as subkey gen.
62
Feistel Cipher Design Elements Discussions
63
Dependency on function F
The derivation does not require that F be a reversible function.
For example, F produces a constant output (e.g., all ones) regardless of the
values of its two arguments.
64
Dependency on function F
65
Symmetric Block Cipher Algorithms
P10 (permutate)
Input : 1 2 3 4 5 6 7 8 9 10
Output: 3 5 2 7 4 10 1 9 8 6
P8 (select and permutate)
Input : 1 2 3 4 5 6 7 8 9 10
Output: 6 3 7 4 8 5 10 9
P4 (permutate)
Input : 1 2 3 4
Output: 2 4 3 1
Example S-DES : Key generation
Then the steps for generating the two 8-bit round keys, K1 and K2, are:
2. Left shift by 1 position both the left and right halves: 00001 11000
4. Left shift by 2 positions the left and right halves: 00100 00011
2-bit output
Comparing DES and S-DES
S-DES Summary
Security of S-DES:
10-bit key, 1024 keys: brute force easy
If know plaintext and corresponding ciphertext, can we
Using
Electronic
Frontier
Foundation
(EFF) DES
cracker
Appx 10 hrs.
for DES
Triple DES
As with any encryption scheme, there are two inputs to the encryption
function: the plaintext to be encrypted and the key
the processing of the plaintext proceeds in three phases.
1. First, the 64-bit plaintext passes through an initial permutation (IP) that
rearranges the bits to produce the permuted input.
2. This is followed by a phase consisting of sixteen rounds of the same
function, which involves both permutation and substitution functions.
3. The left and right halves of the output are swapped to produce the
preoutput.
4. Finally, the preoutput is passed through a permutation [IP -1] that is the
inverse of the initial permutation function, to produce the 64-bit ciphertext.
DES Encryption Algorithm Overview
Round
1. Initial and Final Permutation
The third
column
shows the
number of
bits that differ
between the
two
intermediate
values.
Avalanche Eect in DES: Change in Key
shows a similar
test using the
original plaintext
of with two keys
that
differ in only the
fourth bit
position:
Concerns of DES
Recent offerings confirm this. Both Intel and AMD now offer hardware-based
instructions to accelerate the use of AES. Test run on a contemporary multicore
Intel machine resulted in an encryption rate of about half a billion encryptions per
second.
3DES uses 128-bit keys
Concern of DES
Differential Cryptanalysis
Observe how pairs of plaintext blocks evolve
Break DES in 247 encryptions (compared to 255); but require 247 chosen
plaintexts
Linear Cryptanalysis
Find linear approximations of the transformations
Break DES using 243 known plaintexts
Choosing F
Non-linerity in rough terms, the more difficult it is to approximate
F by a set of linear equations, the more nonlinear F is.
Options:
1. Double DES: not much better than single DES
2. Triple DES (3DES) with 2 keys: brute force 2112
3. Triple DES with 3 keys: brute force 2168
Double Encryption