Alice and Hob have designed a very simple block cipher with the following encryp
ID: 3757793 • Letter: A
Question
Alice and Hob have designed a very simple block cipher with the following encryption protocol using an 8-bit shared secret key: the message is a binary string. It is padded at the right-most end with 0's so that its length is divisible by 8. the padded message is split into blocks of 8 bits each. A further block of 8 bits is appended at the right-most end, containing the length of the original message, in bits. (It is assumed that messages are of length less than 2^8=256, so that the length will fit into an 8-bit block) starting with the left-most message block: The key is XORed with the message block to obtain the ciphertext block, The message block and the key are then added together (using ordinary binary integer addition) and the 8 most significant bits (since the result can be more than 8 bits) form the key for the next block.Explanation / Answer
Lets try to understand the Algorithm with below example.
Given Message = 11000100100001
Key = key
Step 1:
Message = 11000100100001
The length of message is 14-bits, so padding 2 0's in right,
Padded Message = 1100010010000100
Length of new padded message is 16 bit
Step 2:
11000100 10000100
There are two 8-bit block
Step 3:
11000100 10000100
Step 4:
1st block
(i). 11000100 XOR <Key> = <res1>
(ii). 11000100 + key = (8 MSB + some bits)
2nd block
key = (8 MSB + some bits) from 1st block
(i). 10000100 XOR key = <res2>
(ii). 10000100 + key = (8 MSB + some bits)
Encrypted Result for 11000100100001 is <res1> <res2>
Let me know if c/c++/java program was expected
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.