Step 1: Public Parameters
Both Alice and Bob agree on public parameters:
Prime (p) =
Generator (g) =
Step 3: Public Key Generation
Alice calculates:
A = ga mod p
A =
A =
Bob calculates:
B = gb mod p
B =
B =
Step 4: Public Key Exchange
Alice → A = → Bob
Bob → B = → Alice
Step 5: Shared Secret Calculation
Alice calculates:
Secret = Ba mod p
Secret =
Secret =
Bob calculates:
Secret = Ab mod p
Secret =
Secret =
Step 6: Using the Shared Secret for Encryption
Now that Alice and Bob have established a shared secret, they can use it to encrypt messages!
Alice's Encryption Process:
Original Message: "
"
Encryption Method: XOR each character with the shared secret
Shared Secret:
Encrypted (hex):
Transmission Over Insecure Channel:
Alice →
→ Bob
Bob's Decryption Process:
Received (hex):
Decryption Method: XOR each byte with the shared secret
Shared Secret:
Decrypted Message: "
"