Key Exchange Space#

This is a helper notebook for Wednesday’s lecture, where students can perform calculations “in private”. The main lecture on Wednesday will take place in the Week2-Wednesday notebook.

!pip install pycryptodome
Requirement already satisfied: pycryptodome in /root/venv/lib/python3.9/site-packages (3.18.0)
WARNING: You are using pip version 22.0.4; however, version 23.1.2 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.

from Crypto.Util.number import getPrime, getRandomNBitInteger
from sympy.ntheory import n_order
# role of Alice 
a = getRandomNBitInteger(28)
a # display the integer so you don't lose access to it if the hardware resets
164382127
p = 1043283653
g = 2
A = pow(2, a, p)
A
285398211
Created in deepnote.com Created in Deepnote