# Public Key Cryptography Interactivity

##### Age 16 to 18

This interactivity can be used to try out the ideas explained in the article Public Key Cryptography.  We suggest that you take a look at the article before experimenting with the interactivity.  There are some videos explaining how to use the interactivity in the Getting Started section.

By clicking on the purple cog you can enter the settings menu where you can change the settings as follows:

1. Choose to play as either:
* Alice.  Alice is trying to send a message to Bob
Bob. Bob sends Alice his public key so that she can encode her message.  Bob will use his private key to decode the message.
Eve. Eve is eavesdropping on Alice and Bob, and can hear/see Bob's public key and Alice's encoded message.  Eve wants to crack the secret message and find out what Alice has told Bob.

2. You can either:
* Choose a role and have the computer play the other roles (by choosing the Simulated setting), or
* Play with other people (by choosing the Group setting) and make sure you each open the interactivity on different computers. You will need to decide who will be Alice and Bob and you will need to be able to communicate with each other (which could be verbally if you are in the same room, or by emailing/group messaging if you are in different locations). If there are three of you, the third person can be Eve, who will need to be able to hear/see Bob's public key and Alice's encoded message.

When you have changed the settings remember to click on one of the two buttons at the bottom of the settings menu to update the interactivity.

The code that has been used to convert characters into numbers can be found here.

We are very grateful to the Heilbronn Institute for Mathematical Research for their generous support for the development of this resource.

This problem featured in an NRICH Secondary webinar in April 2021.