Alice

Parameters known by Alice:

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

Receives the ciphertext \( c \).

Computes the secret decryption exponent \( d \):

Decrypts the ciphertext \( c \):

Step y/x

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

Press Enter to generate the parameters. Use the Left and Right arrow keys to navigate between steps.

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

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

Alice then publishes \( 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 knows the values of \( e \) and \( \phi(n) \), she can easily compute the secret decryption exponent \( d \) using the extended Euclidean algorithm.

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

Bob

Parameters known by Bob:

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

Converts each letter to its corresponding ASCII value:

Encrypts the message \( m \):