# Using symmetric-key cryptography

A group of 30 people who wish to establish pair-wise secure communications using symmetric-key cryptography. How many KEYS need to be exchanged in total?

• Is this a trick question or extreme laziness? ... 435 – deviantfan Aug 28 '17 at 18:01
• No, it's a real question out of a text book and I am very confused and looking for some help. – bruce geiger Aug 28 '17 at 18:21
• To explain exactly the part you have trouble with (meaning, without rewriting the whole book), it might help if you describe your problem a bit more. What did you try and why, where are you stuck? And/or do you not know what some word means? And/or ... – deviantfan Aug 28 '17 at 18:41
• It might help to make it simpler; suppose there are 3 people (Alice, Bob, Carol) who wish to establish pair-wise secure communication; how many KEYS need to be exchange in total? Once you have that, how about 4 people? Once you see how it works in the small, ramping it up to 30 should be easy... – poncho Aug 28 '17 at 20:53

Let's start off with the fact that there are $n\cdot n$ ordered pairs of (person, person). Now we assume that nobody needs encryption to talk to themselves, so we subtract the $n$ pairs where the person is the same, to get $n\cdot n-n=n(n-1)$. Next, we note that the same secret key can be used to send messages on the route (A,B) as on the route (B,A) (with proper care taken to avoid reusing the same nonce, etc). So we divide by two to get $n(n-1)/2$. Finally, we plug in $n=30$ to get $30\cdot 29/2=15\cdot 29=435$.