0% found this document useful (0 votes)
15 views9 pages

Chapter 4

The document explains the differences between block ciphers and stream ciphers, highlighting their data processing methods, complexity, and error propagation. It also discusses the strict avalanche criterion for the Feistel F function, emphasizing its importance for security. Additionally, it covers chosen plaintext attacks on Feistel ciphers and the vulnerabilities of linear block ciphers, along with numerical examples related to the DES algorithm.

Uploaded by

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

Chapter 4

The document explains the differences between block ciphers and stream ciphers, highlighting their data processing methods, complexity, and error propagation. It also discusses the strict avalanche criterion for the Feistel F function, emphasizing its importance for security. Additionally, it covers chosen plaintext attacks on Feistel ciphers and the vulnerabilities of linear block ciphers, along with numerical examples related to the DES algorithm.

Uploaded by

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

What is the difference between a block cipher and a stream cipher?

The difference between block ciphers and stream ciphers is a key concept in
cryptography. Here's a concise comparison:

Block Cipher

 Data Processing: Encrypts data in fixed-size blocks (e.g., 64 bits, 128 bits).
 Operation: Each block of plaintext is encrypted separately using the same
key.
 Examples: AES (Advanced Encryption Standard), DES (Data Encryption
Standard).
 Usage: Suitable for applications where data size is known and can be
processed in chunks, such as file encryption.

Stream Cipher

 Data Processing: Encrypts data one bit or byte at a time.


 Operation: Generates a keystream (a sequence of bits) that is combined with
the plaintext bit-by-bit or byte-by-byte.
 Examples: RC4, A5/1.
 Usage: Ideal for real-time applications where data size is not fixed, such as
secure communications.

Key Differences

1. Processing Method:
o Block ciphers process data in blocks, making them more suitable for
scenarios where data can be divided into fixed-size chunks.
o Stream ciphers process data continuously, making them more suitable
for streaming data or real-time applications.
2. Complexity:
o Block ciphers often involve more complex algorithms and modes of
operation (e.g., ECB, CBC).
o Stream ciphers are generally simpler and faster, as they operate on
smaller units of data.
3. Error Propagation:
o In block ciphers, an error in one block can affect the decryption of
subsequent blocks, depending on the mode of operation.
o In stream ciphers, an error in one bit or byte typically only affects the
corresponding bit or byte in the ciphertext.

If you have any more questions or need further clarification, feel free to ask!
What is the strict avalanche criterion for the Feistel F function

The strict avalanche criterion (SAC) is a formalization of the avalanche effect in


cryptographic algorithms. According to "Cryptography and Network Security" by
William Stallings, the SAC states that any output bit of an S-box should change with
a 50% probability whenever a single input bit is complemented[1][2].

Application to Feistel F Function

In the context of the Feistel network, the F function is a critical component that
contributes to the cipher's security. For the F function to satisfy the SAC, it must
ensure that flipping any single bit of its input results in each output bit changing with
a 50% probability. This means that the F function should exhibit high nonlinearity
and randomness to achieve this criterion[1][3].

Importance

 Security: Ensuring the SAC helps in making the cipher resistant to differential
cryptanalysis, as it prevents predictable changes in the output when the input
is slightly altered.
 Design: Cryptographic designers aim to construct functions that meet the
SAC to enhance the overall security of the cipher.

If you have any more questions or need further clarification, feel free to ask!

[1]: Wikipedia [2]: ACM Digital Library [3]: Springer

References
[1] William Stallings, Cryptography and Network Security 5/e
[2] Avalanche effect - Wikipedia
[3] Ch03-testbank - lecture notes - Stallings CHAPTER 3: BLOCK ... - Studocu

Briefly define the terms substitution and permutation.

Sure! Here are brief definitions of the terms substitution and permutation in the
context of cryptography:
Substitution

 Definition: Substitution is a cryptographic technique where each element in


the plaintext is replaced with another element. This can be done using a fixed
system (like a substitution cipher) or a more complex algorithm.
 Example: In the Caesar cipher, each letter in the plaintext is shifted a certain
number of places down or up the alphabet.

Permutation

 Definition: Permutation involves rearranging the elements of the plaintext


according to a specific system or algorithm. Unlike substitution, permutation
does not change the elements themselves but changes their order.
 Example: In the transposition cipher, the positions of the characters in the
plaintext are shifted according to a defined pattern.

If you have any more questions or need further clarification, feel free to ask!

Consider a Feistel cipher composed of sixteen rounds with a block length of 128 bits
and a key length of 128 bits. Suppose that, for a given k, the key scheduling
algorithm
determines values for the first eight round keys, k1, k2, c k8, and then sets
k9 = k8, k10 = k7, k11 = k6, c, k16 = k1
Suppose you have a ciphertext c. Explain how, with access to an encryption oracle,
you can decrypt c and determine m using just a single oracle query. This shows that
such a cipher is vulnerable to a chosen plaintext attack. (An encryption oracle can be
thought of as a device that, when given a plaintext, returns the corresponding
ciphertext. The internal details of the device are not known to you and you cannot
break
open the device. You can only gain information from the oracle by making queries to
it and observing its responses.)

To demonstrate how a Feistel cipher with the given key scheduling algorithm is
vulnerable to a chosen plaintext attack, let's break down the process:

Key Scheduling Algorithm

 The key scheduling algorithm determines the round keys as follows:


o ( k1, k2, \ldots, k_8 )
o ( k9 = k8, k{10} = k7, \ldots, k{16} = k1 )

Encryption Oracle
 An encryption oracle is a device that, when given a plaintext, returns the
corresponding ciphertext. You can query the oracle with any plaintext and
observe the ciphertext.

Attack Strategy

1. Query the Oracle:


o Choose a plaintext ( P ) consisting of two 64-bit halves: ( P = (L0, R0) ).
o Query the encryption oracle with ( P ) to get the ciphertext ( C =
(L{16}, R{16}) ).
2. Construct a Special Plaintext:
o Construct a special plaintext ( P' ) by swapping the halves of the
ciphertext ( C ): ( P' = (R{16}, L{16}) ).
3. Query the Oracle with the Special Plaintext:
o Query the encryption oracle with ( P' ) to get the new ciphertext ( C' =
(L'{16}, R'{16}) ).

Explanation

 In a Feistel cipher, the encryption process for 16 rounds can be represented


as: [ (L{i+1}, R{i+1}) = (Ri, Li \oplus F(Ri, k{i+1})) ]
 Given the key scheduling algorithm, the round keys for the second half of the
encryption are the reverse of the first half.
 When you query the oracle with ( P' = (R{16}, L{16}) ), the encryption
process effectively decrypts the original ciphertext ( C ) due to the symmetric
nature of the key scheduling.

Result

 The new ciphertext ( C' ) will be the original plaintext ( P ) but with the halves
swapped: ( C' = (R0, L0) ).
 By swapping the halves of ( C' ), you recover the original plaintext ( P = (L0,
R0) ).

Conclusion

This attack shows that the Feistel cipher with the given key scheduling algorithm is
vulnerable to a chosen plaintext attack. By making a single query to the encryption
oracle with a specially constructed plaintext, you can decrypt the ciphertext and
recover the original plaintext.

If you have any further questions or need more details, feel free to ask!
4.4 Consider a block encryption algorithm that encrypts blocks of length n, and let
N = 2n
. Say we have t plaintext–ciphertext pairs Pi
, Ci = E(K, Pi
), where we assume that the key K is a randomly chosen m-bit string. Imagine that
we wish to find
K by exhaustive search. We could generate key K′ and test whether Ci = E(K′, Pi
)
for 1cict. If K′ encrypts each Pi to its proper Ci
, then we have evidence that
K = K′. However, it may be the case that the mappings E(K, # ) and E(K′, # ) exactly
agree on the t plaintext–ciphertext pairs Pi
, Ci and agree on no other pairs. Such keys
are called spurious keys.
a. What is the probability that E(K, # ) and E(K′, # ) agree on exactly t
plaintextciphertext pairs?
b. Find the expected number of spurious keys when E(K, # ) and E(K′, # ) agree on
exactly t plaintext-ciphertext pairs.

Let's address the questions step by step.

Part (a): Probability that ( E(K, #) ) and ( E(K', #) ) agree


on exactly ( t ) plaintext-ciphertext pairs

Given:

 Block length ( n )
 ( N = 2^n )
 ( t ) plaintext-ciphertext pairs
 Key ( K ) is a randomly chosen ( m )-bit string

The probability that ( E(K, #) ) and ( E(K', #) ) agree on exactly ( t ) plaintext-


ciphertext pairs is given by: [ P(\text{agree on } t \text{ pairs}) = \frac{1}{N^t} ]

Part (b): Expected number of spurious keys


The expected number of spurious keys when ( E(K, #) ) and ( E(K', #) ) agree on
exactly ( t ) plaintext-ciphertext pairs is given by: [ \text{Expected number of
spurious keys} = 2^m \cdot \frac{1}{N^t} ]

Calculation

Given:

 ( n = 128 ) (block length in bits)


 ( N = 2^n = 2^{128} )
 ( m = 128 ) (key length in bits)
 ( t = 10 ) (number of plaintext-ciphertext pairs)

1. Probability: [ P(\text{agree on } t \text{ pairs}) = \frac{1}


{(2^{128})^{10}} = \frac{1}{2^{1280}} ]
2. Expected number of spurious keys: [ \text{Expected number of spurious
keys} = 2^{128} \cdot \frac{1}{2^{1280}} = 2^{128 - 1280} = 2^{-
1152} ]

Given the extremely large exponent, the probability and expected number of
spurious keys are effectively zero.

Summary

 Probability: The probability that ( E(K, #) ) and ( E(K', #) ) agree on exactly


( t ) plaintext-ciphertext pairs is ( \frac{1}{2^{1280}} ).
 Expected number of spurious keys: The expected number of spurious
keys is ( 2^{-1152} ), which is effectively zero.

If you have any further questions or need more details, feel free to ask!

For any block cipher, the fact that it is a nonlinear function is crucial to its security. To
see this, suppose that we have a linear block cipher EL that encrypts 256-bit blocks
of
plaintext into 256-bit blocks of ciphertext. Let EL(k, m) denote the encryption of a

EL(k, [m1 ⊕ m2]) = EL(k, m1) ⊕ EL(k, m2) for all 128@bit patterns m1, m2.
256-bit message m under a key k (the actual bit length of k is irrelevant). Thus,

Describe how, with 256 chosen ciphertexts, an adversary can decrypt any ciphertext
without knowledge of the secret key k. (A “chosen ciphertext” means that an
adversary has the ability to choose a ciphertext and then obtain its decryption. Here,
you
have 256 plaintext/ciphertext pairs to work with, and you have the ability to choose
the value of the ciphertexts.)
To demonstrate how an adversary can decrypt any ciphertext without knowledge of
the secret key ( k ) using a linear block cipher ( E_L ), let's break down the process:

Given

 ( E_L(k, m) ) is a linear block cipher that encrypts 256-bit blocks of plaintext


into 256-bit blocks of ciphertext.
 The linear property: ( EL(k, [m1 \oplus m2]) = EL(k, m1) \oplus EL(k, m2) ) for
all 256-bit patterns ( m1 ) and ( m_2 ).
 The adversary has access to 256 chosen plaintext-ciphertext pairs.

Attack Strategy

1. Choose 256 Plaintexts:


o The adversary chooses 256 distinct plaintexts ( P1, P2, \ldots,
P_{256} ).
o Encrypt these plaintexts using the encryption oracle to obtain the
corresponding ciphertexts ( C1, C2, \ldots, C_{256} ).
2. Construct a Basis:
o The 256 plaintexts ( P1, P2, \ldots, P{256} ) can be chosen such that
they form a basis for the 256-dimensional vector space over ( \
mathbb{F}2 ).
o This means any 256-bit plaintext ( P ) can be expressed as a linear
combination of the chosen plaintexts.
3. Decrypt Any Ciphertext:
o Given a ciphertext ( C ), the adversary wants to find the corresponding
plaintext ( P ).
o Express ( P ) as a linear combination of the chosen plaintexts: ( P = a1
P1 \oplus a2 P2 \oplus \ldots \oplus a{256} P{256} ), where ( a_i \in {0,
1} ).
o Using the linear property of the cipher, the corresponding ciphertext
( C ) can be expressed as: [ C = EL(k, P) = EL(k, [a1 P1 \oplus a2 P2 \
oplus \ldots \oplus a{256} P{256}]) ] [ C = a1 EL(k, P1) \oplus a2 EL(k,
P2) \oplus \ldots \oplus a{256} EL(k, P_{256}) ]
o Since the adversary knows the ciphertexts ( C1, C2, \ldots, C{256} )
corresponding to the plaintexts ( P1, P2, \ldots, P{256} ), they can
compute: [ P = a1 C1 \oplus a2 C2 \oplus \ldots \oplus a{256} C{256} ]

Conclusion

By leveraging the linear property of the block cipher and the chosen plaintext-
ciphertext pairs, the adversary can decrypt any ciphertext ( C ) without knowledge of
the secret key ( k ). This demonstrates the vulnerability of a linear block cipher to a
chosen ciphertext attack.

If you have any further questions or need more details, feel free to ask!
This problem provides a numerical example of encryption using a one-round version
of DES. We start with the same bit pattern for the key K and the plaintext, namely:
Hexadecimal notation: 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary notation: 0000 0001 0010 0011 0100 0101 0110 0111
1000 1001 1010 1011 1100 1101 1110 1111
a. Derive K1, the first-round subkey.
b. Derive L0, R0.

d. Calculate A = E[R0] ⊕ K1.


c. Expand R0 to get E[R0], where E[ # ] is the expansion function of Table C.1.

e. Group the 48-bit result of (d) into sets of 6 bits and evaluate the corresponding
S-box substitutions.
f. Concatenate the results of (e) to get a 32-bit result, B.

I attempted to implement and execute the Python code to derive the first-round
subkey ( K1 ), ( L0 ), ( R0 ), expand ( R0 ) to get ( E[R0] ), calculate ( A = E[R0] \oplus
K_1 ), group the 48-bit result into sets of 6 bits, evaluate the corresponding S-box
substitutions, and concatenate the results to get a 32-bit result ( B ) using a one-
round version of DES with the given key and plaintext.

However, the Python code execution failed due to an incomplete input error.

Here is the step-by-step approach I took:

1. Convert Hexadecimal to Binary:


o Key and plaintext in hexadecimal notation: 0123456789ABCDEF
o Convert to binary notation.
2. Initial Permutation:
o Apply the initial permutation table to the binary plaintext.
3. Key Schedule:
o Apply Permuted Choice-1 (PC1) to the binary key to get ( C0 ) and
( D0 ).
o Perform left shifts and apply Permuted Choice-2 (PC2) to get the first-
round subkey ( K_1 ).
4. Divide Plaintext:
o Divide the permuted plaintext into ( L0 ) and ( R0 ).
5. Expansion:
o Expand ( R_0 ) using the expansion function ( E ).
6. XOR Operation:
o Calculate ( A = E[R0] \oplus K1 ).
7. S-box Substitution:
o Group the 48-bit result into sets of 6 bits and evaluate the
corresponding S-box substitutions.
8. Concatenate:
o Concatenate the results to get a 32-bit result ( B ).

Alternatives

You can try using external tools or libraries specifically designed for DES encryption,
such as PyCryptodome, which provides a more robust implementation of DES.

If you need further assistance or have any other questions, feel free to ask!

You might also like