Step 1: Public Information Setup
Public information is shared openly between Alice and Bob. This
includes a large prime number (p) and a generator (g). An eavesdropper
can see these values, but they alone don't reveal the final shared
secret.
Step 2: Private Key Generation and Public Key Calculation
Each participant generates their own private key (secret) and
calculates their public key using the formula:
Public Key = g^(private key) mod p
Alice
Bob
Step 3: Verification
Success! If both Alice and Bob calculated the same
shared secret value, they have successfully established a secure
communication channel. This shared secret can now be used as an
encryption key for further communication.
Security Note: Even though an eavesdropper can see
all the public information (p, g, g^a mod p, g^b mod p), they cannot
easily compute the shared secret g^(ab) mod p without solving the
discrete logarithm problem, which is computationally difficult for
large numbers.