# How can the Diffie-Hellman key exchange be extended to three parties? [duplicate]

Possible Duplicate:
Can one generalize the Diffie-Hellman key exchange to three or more parties?

How can Alice, Bob, and Charlie share a common secret key using an extended version of the Diffie-Hellman key exchange protocol?

a=3, b=4, c=5
g=2
p=5

-

## marked as duplicate by Paŭlo EbermannAug 30 '12 at 16:54

Welcome to Cryptography Stack Exchange. I closed your question as a duplicate to another already existing one, since it is quite similar. Please have a look at the answers there. – Paŭlo Ebermann Aug 30 '12 at 16:56

1. Alice computes $A=g^a$, Bob computes $B=g^b$ and Charlie computes $C=g^c$.

2. $A,B$ and $C$ are published.

3. Alice computes $AC=C^a$ and $AB=B^a$ and Bob computes $BC=C^b$.

4. $AB,AC$ and $BC$ are published.

5. Alice computes $ABC=BC^a$, Bob computes $ABC=AC^b$ and Charlie computes $ABC=AB^c$.

6. Everybody shares $ABC=g^{abc}$.

This can be generalized for any number of participants in a tree construction, however it becomes increasingly inefficient, because the number of rounds increases.

-
Do we use the p ? – Mu12 Aug 30 '12 at 7:10
I suppose you want to work in group $\mathbb{Z}_p^*$. The problem is that your numbers don't make sense. First of all the order of $\mathbb{Z}_p^*$ is 4, therefore valid exponents are $\{0,1,2,3\}$. Additionally you would usually want a group of prime order. But other than that, yes, if you work in $\mathbb{Z}_p^*$, the exponentiations are done $\mod p$ – Maeher Aug 30 '12 at 7:26
I tried doing Z∗p but it gave a very large number, also it didn't use the p which confused me! – Mu12 Aug 30 '12 at 7:42
@Mu12: Use the square-and-multiply method for exponentiation, and do modular reduction after each step, not only at the end. – Paŭlo Ebermann Sep 10 '12 at 18:17