Diffie Hillman Key Exchange Algorithm

Prior agreement on two parameters, q, a large prime, and $\alpha$, a primitive root of q.

Alice selects a random int $X_A$ and sends to Bob

$Y_A = \alpha^{X_A} mod \; q$

Bob selects a random int $X_B$ and sends to Alice

$Y_B = \alpha^{X_B} mod \; q$

$K = (Y_B)^{X_A} mod \; q = (Y_A)^{X_B} mod \; q =$

$\alpha^{X_A X_B} mod \; q$