1. ## Block cipher(cryptography)

The block cipher $\displaystyle \left(\mathcal{P},\mathcal{C},\mathcal{K},\mathcal {E},\mathcal{D}\right)$ is defined as follows. The alphabet is {0,1}, block length is 3 and the key space $\displaystyle \mathcal{K}$ is $\displaystyle \mathbb{Z}_8$. Given a key $\displaystyle n\in\mathbb{Z}_8$ and a plaintext $\displaystyle p$, let $\displaystyle p'$ be $\displaystyle p$ written as a decimal number. We define $\displaystyle E_n(p)$ to be $\displaystyle p'+nmod8$ written as a 3-digit binary number (possibly with initial zeros), and we define $\displaystyle D_n(p)$ in exactly the same way. The functions $\displaystyle E_n$ and $\displaystyle D_n$ are the encryption and decryption functions respectively of the cryptosystem.

(a) Find $\displaystyle E_5(110),E_2(001),E_0(101).$
(b) Given an excryption key $\displaystyle n$, find a corresponding decryption key

Any help would be greatly appreciated, thanks=)

2. For part (a), it looks as though you simply add $\displaystyle n$ to the plaintext, and then mod out $\displaystyle 8$. Example:

$\displaystyle E_{3}(010_{2})=2+3\;\text{mod}\;8=5\;\text{mod}\;8 =101_{2}.$

Here I've used the subscript $\displaystyle 2$ to indicate that I'm writing the number base $\displaystyle 2$.

Does that make sense?

For part (b), you have to find a way to invert the operation in part (a). So, taking my example, we had better find that

$\displaystyle D_{n}(101_{2})=010_{2},$ using some integer $\displaystyle n$. How do you undo addition? How do you undo addition modulo an integer?

3. Hi Ackbeet, thanks a lot for your post, I understand now =)

4. You're welcome. Have a good one!