Home /
Expert Answers /
Computer Science /
i-am-double-checking-something-here-as-i-need-to-make-sure-i-get-the-correct-answer-i-put-my-questi-pa307

**I am double-checking something here as I need to make sure I get the correct answer. I put my questions in bold that I need help with.**

**----------Here is the question I have to do for an assignment-----------**

3. Given the following:

- An encryption function ????(????,????) that computes ciphertext ???? by breaking plaintext ???? into 32-bit blocks and XORing each plaintext block with the key ???? to get the corresponding ciphertext block.

-A MAC function ????????????(????, ????) that computes authentication tag ???? by breaking message ???? into 32-bit blocks and XORing them together along with key ????.

-A plaintext ???? = ???????????????????????????????? ???????????????????????????????? ????????????????????????????????.

-Encryption key ????1 = ????????????????????????????????.

-Authentication key ????2 = ????????????????????????????????.

Compute ciphertext ???? and authentication tag ???? using the following schemes:

(a) Encrypt-and-MAC (5 pts)

(b) MAC-then-Encrypt (5 pts)

(c) Encrypt-then-MAC (5 pts)

**------------------Is the answer for a) completely correct?------------**

a) Encryption and MAC: **The main question is: Is C3 correct? If so, why did it start off with P3 instead of C3= K1 XOR P3?**

To encrypt plaintext P with the Encrypt-and-MAC scheme, we must first divide it into 32-bit blocks:

P1 = 113cc16c

0dd18cbf = P2

P3 = ee387507

The ciphertext C is then computed by XORing each plaintext block with key K1:

C1 = K1 XOR P1 = 3f359d79 XOR 113cc16c = 2e095c15

C2 = K1 XOR P2 = 3f359d79 XOR 0dd18cbf = 32e985c6

**P3 = 3f359d79 XOR C3 = K1 XOR ee387507 = dd0aeb7e**

The authentication tag T is then computed by dividing the ciphertext C into 32-bit blocks and XORing them with the key K2:

T = MAC(K2, C) = K2 XOR C1 XOR C2 XOR C3 = 2b88b87e XOR 2e095c15 XOR 32e985c6 XOR dd0aeb7e = 0c08af43 T = MAC(K2, C) = K2 XOR C1 XOR C2 XOR C3 = 2b88b87e XOR 2e0

As a result, the authentication tag T is 0c08af43 and the ciphertext C is 2e095c15 32e985c6 dd0aeb7e.