Exercise 3.16.1
#include <iostream> using namespace std; int main(){ string input = "VHFUHW"; for(int shift = 0; shift < 26; shift++){ cout << "shift: " << shift << " "; for (char chr : input) cout << char('A' + (chr - 'A' + step) % 26); cout << endl; } }
Results
shift: 0 VHFUHW shift: 1 WIGVIX ... shift: 22 RDBQDS shift: 23 SECRET shift: 24 TFDSFU shift: 25 UGETGV
The Answer is SECRET.
Exercise 3.16.2
The plaintext space, cipher text space are . The key space is .
Exercise 3.16.4
The number of palindromes having length over an alphabet is , where .
Exercise 3.16.6
The number of possible blocks is . The key space is the set of all permutations of and contains elements. so the answer is .
Exercise 3.16.7
The latter scheme is a cryptosystem. The encryption functions must be injective. The former scheme, however, the function isn't injective if . For example, if , letters and lead the same cipher .
The plaintext space of the latter scheme is , the ciphertext space is also and the key space is .
Exercise 3.16.8
A tuple with the following properties:
- , where
- , where
Exercise 3.16.9
the number of bit permutations:
the number of circular right shifts: (or if 0 shift is included.)
Exercise 3.16.11
The answer can be represented below:
For instance, a plaintext will be transformed into
Exercise 3.16.12
, where .
Suppose the permutation above is affine linear. We can say there is a matrix , and a vector such that:
for all .
Since ,
, ,
Therefore,
But we know that and . Hence, The permutation above is not affine linear.
Exercise 3.16.14
ciphertext: with length block length: key:
ECB mode
ciphertext blocks:
ciphertext blocks:
ciphertext:
CFB mode
plaintext blocks:
initialization vector:
1 | 000 | 000 | 00 | 11 | 11 |
2 | 011 | 110 | 11 | 11 | 00 |
3 | 100 | 001 | 00 | 11 | 11 |
4 | 011 | 110 | 11 | 11 | 00 |
5 | 100 | 001 | 00 | 11 | 11 |
6 | 011 | 110 | 11 | 11 | 00 |
ciphertext blocks:
ciphertext:
OFB mode
plaintext blocks:
initialization vector:
1 | 000 | 000 | 00 | 11 | 11 |
2 | 000 | 000 | 00 | 11 | 11 |
3 | 000 | 000 | 00 | 11 | 11 |
4 | 000 | 000 | 00 | 11 | 11 |
5 | 000 | 000 | 00 | 11 | 11 |
6 | 000 | 000 | 00 | 11 | 11 |
ciphertext blocks:
ciphertext:
Exercise 3.16.15
ECB mode
cipertext:
CBC mode
cipertext:
CFB mode
1 | 000 | 000 | 00 | 10 | 10 |
2 | 010 | 100 | 10 | 10 | 00 |
3 | 000 | 000 | 00 | 10 | 10 |
4 | 010 | 100 | 10 | 10 | 00 |
5 | 000 | 000 | 00 | 10 | 10 |
6 | 010 | 100 | 10 | 10 | 00 |
ciphertext:
OFB mode
1 | 000 | 000 | 00 | 10 | 10 |
2 | 000 | 000 | 00 | 10 | 10 |
3 | 000 | 000 | 00 | 10 | 10 |
4 | 000 | 000 | 00 | 10 | 10 |
5 | 000 | 000 | 00 | 10 | 10 |
6 | 000 | 000 | 00 | 10 | 10 |
ciphertext:
Exercise 3.16.18
-18
Exercise 3.16.19
Sarrus' rule:
Exercise 3.16.20
, where is an identity matrix.
Exercise 3.16.21
Note that each elements must be in .
Exercise 3.16.22
The key is , , where is an identity matrix.
Note that we identify the alphabet according to Table 3.1 with the numbers .