or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Cryptography and computer security - Tutorial 3.11.2020
Block ciphers
Exercise 1
Let \(y\) be the output of a SPN on input \(x\), where \(\ell=m=N_r=4\), and permutations \(\pi_S\) and \(\pi_P\) be defined as
and
Suppose that the round key \(K_1 = {\tt 0x3954}\) is given in a hexadecimal notation. Compute one round of the SPN for the plaintext \(x = {\tt 0x295C}\).
Exercise 2
Consider a \(2\)-round Feistel network with encryption function \(f(R, K) = R \oplus K\). Assume that all subkeys are equal, i.e., \(K = K_0 = K_1 = K_2\), with subkey size being half the block size. Show that this cipher is not secure.
\[ \begin{aligned} L_1 &= R_0 & R_1 &= L_0 \oplus R_0 \oplus K \\ L_2 &= R_1 & R_2 &= L_1 \oplus R_1 \oplus K \\ &= L_0 \oplus R_0 \oplus K &&= R_0 \oplus (L_0 \oplus R_0 \oplus K) \oplus K \\ &&&= L_0 \\ L_3 &= R_2 & R_3 &= L_2 \oplus R_2 \oplus K \\ &= L_0 &&= (L_0 \oplus R_0 \oplus K) \oplus L_0 \oplus K \\ &&&= R_0 \end{aligned} \]
Exercise 3
Prove that decryption in a Feistel cipher can be done by applying the encryption algorithm to the ciphertext with the key schedule reversed.
\[ \begin{aligned} L_{i+1} &= L_i \oplus F(R_i, K_i) & R_{i+1} &= R_i \\ L_i &= L_{i+1} \oplus F(R_{i+1}, K_i) & R_i &= R_{i+1} \end{aligned} \]
Attacks on block ciphers
Exercise 4
Since DES has too short keys (\(56\) bits), we decide to combine DES with XOR to achieve \(120\)-bit encryption. We pick a \(56\)-bit key \(k_1\) for regular DES and a \(64\)-bit key \(k_2\). To encrypt a block \(m\), we first encrypt it using DES and then XOR the result with the second key. Mathematically, our encryption scheme is:
\[ \text{DESX}_{k_1, k_2}(m) = \text{DES}_{k_1}(m) \oplus k_2 . \]
Show that DESX is not much more secure than basic DES, as far as exhaustive key search goes.
Exercise 5
We now look at the following variant of key whitening with DES. Suppose that the message \(m\) and the keys \(k_1\) and \(k_2\) are \(64\) and \(56\) bits long. The encryption is defined as
\[ \text{DESW}_{k_1, k_2}(m) = \text{DES}_{k_2}(m \oplus k_1) \]
Show that breaking DESW is roughly as difficult as a brute force attack against single DES.
\[ \text{2DES}_{k_1, k_2}(m) = \text{DES}_{k_1}(\text{DES}_{k_2}(m)) \]
Exercise 6
Suppose that we encrypt a message \(m\) in three DES rounds:
\[ c = \text{DES}_{k_3}(\text{DES}_{k_2}^{-1}(\text{DES}_{k_1}(m))) . \]
When does this scheme reduce to single DES?
Modes of operation
Exercise 7
For each mode of operation, give the mathematical expression of the decryption and draw the corresponding block diagram.
Exercise 8
For which modes of operation does \(E_k(m \oplus x) = E_k(m) \oplus x\) hold?
Exercise 9
Which modes of operation allow random access to the ciphertext blocks? That is, if the recipient has the information \((i, c_i)\), can they decrypt the message \(m_i\) without having any other ciphertext blocks? If not, what additional information do they need?
Exercise 10
Suppose an attacker changes one block of the ciphertext \(c_i\) into \(c'_i \not= c_i\). Which blocks are then decrypted incorrectly when using ECB, CBC, CFB, OFB and CTR modes?