Did You Know: Stronger Together
Neither encryption nor exception handling alone can entirely protect an app, but used together, they improve its chances of not being intercepted AND not halting script execution due to an exception.
Your Turn: Add Encryption
Now it is time to implement exception handling + encryption with the Share Something Personal app.
- Insert the ascii_shift function immediately above the while True: statement in both copies of the radio_send_receive_images_w_buttons script.
- Insert the two lines of code shown above radio.send(packet) in the image below.
- Change and add the lines shown below the if packet: statement.
- Change the script project name, appending it with _your_turn.
- Save the modified script and flash it into both micro:bit modules with the Send to micro:bit button.
- Test the application to make sure it still exchanges images the way it did previously.
- If the serial monitors aren't already open, click Show serial in the python.microbit.org editors, and monitor the encryption and decryption.