Click on the steps of the key generation, encryption of a message, and decryption of a message to see the values of the variables as they are chosen and computed. In the dashed boxes the information known to Alice and Box and the information that can be observed by the eavesdropper Eve is shown.
New Example Restart
Eve knows:
Alice knows Bob: Key Generation Bob chooses p Bob knows
Bob chooses g
Bob chooses b

Bob computes

B=gb
Bob publishes his public key (p,g,B)
Public key directory. .
Alice wants to send Bob the secret message m

Alice gets (p,g,B)

from public key directory
Alice: Encryption
Alice chooses a

Alice computes

A=ga

Alice computes

s=Ba

Alice encrypts m as

X=ms
Alice sends (A,X) Bob receives (A,X)
Bob: Decryption

Bob computes

s=Ab

Bob finds s-1⊗

with ss-1⊗=1

Bob decrypts X to

m=Xs-1⊗