In: Computer Science
Consider a simple system with 8-bit block size. Assume the encryption (and decryption) to be a simple XOR of the key with the input. In other words, to encrypt x with k we simply perform x⊕k giving y. Similarly, to decrypt y, we perform y⊕k giving x.
You are given the following 16-bit input 1A2Bin hexadecimal. You are provided IV as 9D in hexadecimal. The key to be used (where appropriate) is 7C in hexadecimal. Compute the encrypted output with the following methods. Express your final answer, for each of them, as 4 hexadecimal characters so it is easy to read.
A. ECB
B. CBC
C. OFB
D. CFB
Note: Done accordingly. Please comment for any problem. Please Uprate. Thanks
Solution:
Plaintext:1111000011110000 (F0F0)
IV: 00001111
KEY: 11000111
Encryption: XOR
XOR TABLE:
A |
B |
R |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
i) ECB
i.e. Plaintext(each block) XOR Key:
Plaintext:1111000011110000 (F0F0)
KEY: 11000111
Therefore:
Block1 |
11110000 |
KEY |
11000111 |
XOR |
|
Ciphertext1 |
00110111 |
Block2 |
11110000 |
KEY |
11000111 |
XOR |
|
Ciphertext2 |
00110111 |
So cipher text= Ciphertext1Ciphertext2
Cipher text=0011011100110111 or in hex (3737)
ii) CBC
Block1 |
11110000 |
IV |
00001111 |
XOR |
|
R1 |
11111111 |
KEY |
11000111 |
CipherText1 |
00111000 |
Block2 |
11110000 |
CipherText1 |
00111000 |
XOR |
|
R2 |
11001000 |
KEY |
11000111 |
CipherText2 |
00001111 |
So cipher text=CipherText1CipherText2
Cipher text=0011100000001111 or in hex (380F)
iii)
KEY |
11000111 |
IV |
00001111 |
XOR |
|
R1 |
11001000 |
Block1 |
11110000 |
CipherText1 |
00111000 |
KEY |
11000111 |
R1 |
11001000 |
XOR |
|
R2 |
00001111 |
Block2 |
11110000 |
CipherText2 |
11111111 |
So cipher text=CipherText1CipherText2
Cipher text=0011100011111111 or in hex (38FF)
iv)
KEY |
11000111 |
IV |
00001111 |
XOR |
|
R1 |
11001000 |
Block1 |
11110000 |
CipherText1 |
00111000 |
KEY |
11000111 |
CipherText1 |
00111000 |
XOR |
|
R2 |
11111111 |
Block2 |
11110000 |
CipherText2 |
00000000 |
So cipher text=CipherText1CipherText2
Cipher text=0011100000000000 or in hex (3800)
v) CTR
Therefore:
KEY |
11000111 |
Counter |
11001100 |
XOR |
|
R1 |
00001011 |
Block1 |
11110000 |
CipherText1 |
11111011 |
KEY |
11000111 |
Counter |
11001100 |
XOR |
|
R2 |
00001011 |
Block2 |
11110000 |
CipherText2 |
11111011 |
So cipher text=CipherText1CipherText2
Cipher text=1111101111111011 or in hex (FBFB)
i hope it helps..
If you have any doubts please comment and please don't dislike.
PLEASE GIVE ME A LIKE. ITS VERY IMPORTANT FOR ME