Computes the public key \( pk = (n, e) \):

Receives the ciphertext \( c \)

Computes the secret decryption exponent \( d \):

Decrypts the ciphertext \( c \):

Enter the message (a sentence) or key (an integer between 1 and 50300) that Bob wants to send encrypted to Alice:

Hit **enter** to generate the parameters and use the
**left** and **right** arrow keys to navigate.

Alice chooses the two prime numbers \( p \) and \( q \) and computes \( n = p \cdot q \).

She then computes the public encryption exponent \( e \) by randomly choosing a \( 3 \leq e \leq n-1 \) until \( \gcd(e, \phi(n)) = 1 \) where \( \phi(n) = (p - 1) \cdot (q - 1) \).

Alice then publish \( pk = (n, e) \) as her public key and sends it to Bob.

Before Bob can encrypt the message \( m \) he needs to convert each letter into its corresponding ASCII value.

Bob uses Alice's public key \( pk = (n, e) \) to encrypt the message \( m \).

He then sends the ciphertext \( c \) to Alice.

Because Alice know the value of \( e \) and \( \phi(n) \) she can easily compute the secret decryption exponent \( d \) with the extended Euclidean algorithm.

Alice uses her secret key \( sk = (n, d) \) to decrypt the received ciphertext \( c \) from Bob.

Receives the public key \( pk = (n, e) \)

Converts the letters into ASCII values:

Encrypts the message \( m \):