Alice  Bob 
Alice chooses a Private Value a = 
Bob chooses a Private Value b = 

 or 
 or 


Alice computes Public Value:
A = g^{a}
mod n
(Public) A = 
Bob computes Public Value:
B = g^{b}
mod n
(Public) B = 

Alice and Bob exchange Public Values 
Alice and Bob each compute Same Master Value M 

Alice computes M = B^{a}
mod n = g^{b}^{a}
mod n
 Bob computes M = A^{b}
mod n = g^{a}^{b}
mod n 
Alice computes M = 
Bob computes M = 