In: Computer Science
Stream Cipher. A message is encoded by exclusive-or’ing each bit with a random bit stream. (In exclusive or, 0⊕0 = 0, 1⊕0 = 1, 0⊕1 = 1, and 1⊕1 = 0.)
a. Recover the original message from the random stream and encrypted stream, by filling in the blanks in the “Recovered” and “ASCII” rows. (In the ASCII column, interpret the byte as an ASCII character and write the value in that row.)
Message: |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
? |
Random |
1 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
1 |
Encrypted |
1 |
1 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
0 |
Recovered |
||||||||||||||||||||||||
ASCII |
b. Write a few ways that the sender and receiver might share the “Random” stream. Write an advantage for each way.
The message can be obtained by xor-ing encrypted and Random bits, this is possible because of the significant property possessed by XoR operation (a XOR a = 0).
So Recovered = : 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 1 0 1 0 0 0 0 0 1
Grouping the bits into bytes, we have 01010010 --> 82 --> R
01010011 --> 83 --> S
01000001 --> 65 --> A
Ways to share Random stream between sender and receiver:
1) Sender and Receiver agree on an algorithm, secret key, and parameters in advance to generate the random stream without sending it lonely at ciphertext transmission. It is an easier and more convenient way to share random streams as key.
2) They can also share the random streams with the help of asymmetric encryption, where keystream is encrypted using public-key encryption like RSA, Elgamal, etc. This method is more expensive but reliable.
3) To meet the receiver in person and share random keys before the transmission of ciphertext. This trick works better in the defense sector where interception of transmissions is highly taken care of. Although it provides highest level of security but looks impractical for real-life scenarios where huge messages are transmitted in a very short interval of time.