Use Pseudo-random generator to exchange communication key

Write 2 python programs to show the implementation of a secure message system between Alice and Bob.

  1. Perform a secure key-exchange of say 32 bits.
  2. Use a pseudo-random generator to stretch the originally exchanged key to longer and longer pseudo-random strings. This is done “on-demand”. That is, whenever we

need a new “chunk” of pseudo-random bits we ask for it.

  1. Use the pseudo-random output to encrypt and decrypt messages that Alice sends to Bob and vice-versa. For simplicity in your code you could have decided in advance

that e.g. there will be one message from Alice to Bob, then a second message from Bob to Alice and then one last message from Alice to Bob. This simplification is

going to save you writing a few tenths of line of code (compared to a messaging situation where every party can arbitrarily decide to send messages).

Sample Solution