Try This: Monitor Encrypted Text

By changing one print statement and adding another, you can monitor and compare the plaintext and ciphertext versions of the packets.

 

  • Make the adjustments shown below to transmitter and receiver scripts.
  • Test and verify that your results resemble the terminal data shown above.
  • Save your modified transmitter and receiver scripts as countdown_sender_encrypted_try_this and countdown_receiver_encrypted_try_this.  

Transmitter excerpt (not the complete script)

    # Transmitter Excerpt
    
    packet = str(dictionary)
    
    # print("Send: ", packet)
    print("packet: ", packet)                   # <- change

    # Step 3: Call the cipher function to encrypt the data
    # before sending the packet.

    packet = ascii_shift(key, packet)

    radio.send(packet)
    
    print("Encrypted message: ", packet)        # <- add
    print()

 

Receiver excerpt (not the complete script)

    # Receiver Excerpt
    
    packet = radio.receive()
    if packet is not None:
        print("Receive encrypted: ", packet)  # <- add

        # Step 3: Call the cipher function to decrypt the data
        # after receiving/before using the packet.

        packet = ascii_shift(key, packet)

        print("packet: ", packet)             # <- change

        print()