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.
- Save the modified script and flash it into both micro:bit modules.
- Test the application to make sure it still exchanges images the way it did previously.
- Use the Open Serial Buttons in the python.microbit.org/v/2 editors, and monitor the encryption and decryption.